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.coop...@citrix.com>

Acked-by: Wei Liu <w...@xen.org>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to