On Mon, Nov 14, 2022 at 01:06:11PM +0100, Miroslav Lichvar wrote:
> Check the snprintf() return value in order to avoid the following
> warnings from gcc:
> 
> config.c: In function ‘config_create’:
> config.c:921:52: warning: ‘%s’ directive output may be truncated writing up 
> to 9679 bytes into a region of size 33 [-Wformat-truncation=]
>   921 |                 snprintf(buf, sizeof(buf), "global.%s", ci->label);
>       |                                                    ^~
> config.c:921:17: note: ‘snprintf’ output between 8 and 9687 bytes into a 
> destination of size 40
>   921 |                 snprintf(buf, sizeof(buf), "global.%s", ci->label);
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> config.c:364:40: warning: ‘%s’ directive output may be truncated writing up 
> to 9679 bytes into a region of size 133  -Wformat-truncation=]
>   364 |         snprintf(buf, sizeof(buf), "%s.%s", section, name);
>       |                                        ^~
> In function ‘config_section_item’,
>     inlined from ‘config_global_item’ at config.c:371:9,
>     inlined from ‘config_create’ at config.c:931:8:
> config.c:364:9: note: ‘snprintf’ output between 8 and 9687 bytes into a 
> destination of size 140
>   364 |         snprintf(buf, sizeof(buf), "%s.%s", section, name);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>

Applied.

Thanks,
Richard


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to