[LTP] [PATCH 2/2] tst_net_vars.c: Enlarge buffer to fix format overflow warnings

Petr Vorel pvorel@suse.cz
Mon May 20 17:34:11 CEST 2019


Hi,

> tst_net_vars.c:230:18: warning: ‘.0.0’ directive writing 4 bytes into a region of size between 1 and 128 [-Wformat-overflow=]
>   sprintf(buf, "%s.0.0", net_unused);
>                   ^~~~
> In file included from /usr/include/stdio.h:867,
>                  from tst_net_vars.c:26:
> /usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 5 and 132 bytes into a destination of size 128

> tst_net_vars.c:294:18: warning: ‘::’ directive writing 2 bytes into a region of size between 1 and 128 [-Wformat-overflow=]
>   sprintf(buf, "%s::", net_unused);
>                   ^~
> In file included from /usr/include/stdio.h:867,
>                  from tst_net_vars.c:26:
> /usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 3 and 130 bytes into a destination of size 128

> Fixes: d18e135d0 ("network: Add tools for setup IP related environment
> variables")

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/lib/tst_net_vars.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Both commits pushed.

Kind regards,
Petr


More information about the ltp mailing list