[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] tools/xenstat: Fix -Wformat-truncation= issue
On Tue, Aug 13, 2019 at 02:52:11PM +0100, Andrew Cooper wrote: > Building with GCC 8.3 on Buster identifies: > > src/xenstat_linux.c: In function 'xenstat_collect_networks': > src/xenstat_linux.c:307:32: warning: 'snprintf' output may be truncated > before > the last format character [-Wformat-truncation=] > snprintf(devNoBridge, 16, "p%s", devBridge); > ^ > src/xenstat_linux.c:307:2: note: 'snprintf' output between 2 and 17 bytes > into > a destination of size 16 > snprintf(devNoBridge, 16, "p%s", devBridge); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > devNoBridge[] needs one charater more than devBridge[], so allocate one byte > more. Replace a raw 16 in the snprintf() call with a sizeof() expression > instead. > > Finally, libxenstat, unlike most of the rest of the Xen, doesn't use -Werror > which is why this issue went unnoticed in CI. Fix this. > > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Wei Liu <wl@xxxxxxx> _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |