Fix: liblttng-ctl: unreported truncations when copying strings
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 12 Jan 2021 22:41:54 +0000 (17:41 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 18 Jan 2021 17:04:16 +0000 (12:04 -0500)
commit1da0efb1324bb93d7e368e5bf4394edaaf69e9ee
tree87f2e0472d8ad94a7e5ae9234c8efda6c35233d6
parent6391901e022933eaf5936764e69ff3d89e62caa9
Fix: liblttng-ctl: unreported truncations when copying strings

gcc 10.2 reports a large number of string truncation warning in
liblttng-ctl. Replace the uses of lttng_ctl_copy_string() util by
lttng_strncpy() (handling the null source case when applicable) and
report the truncations when they occur.

Example gcc warning:
  lttng-ctl.c:86:3: warning: ‘strncpy’ output may be truncated copying 254 bytes from a string of length 254 [-Wstringop-truncation]

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icca5f4c2490c6796b451999d7694db8597bae719
src/lib/lttng-ctl/channel.c
src/lib/lttng-ctl/load.c
src/lib/lttng-ctl/lttng-ctl-health.c
src/lib/lttng-ctl/lttng-ctl-helper.h
src/lib/lttng-ctl/lttng-ctl.c
src/lib/lttng-ctl/rotate.c
src/lib/lttng-ctl/save.c
src/lib/lttng-ctl/snapshot.c
src/lib/lttng-ctl/tracker.c
This page took 0.035449 seconds and 4 git commands to generate.