Re: [PATCH 1/1] pahole: Make sure the features string is NUL terminated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2024-02-05 at 16:21 -0300, Arnaldo Carvalho de Melo wrote:
> To address this compiler warning:
> 
>   /home/acme/git/pahole/pahole.c: In function ‘parse_btf_features’:
>   /home/acme/git/pahole/pahole.c:1353:9: warning: ‘strncpy’ specified bound 1024 equals destination size [-Wstringop-truncation]
>    1353 |         strncpy(f, features, sizeof(f));
>         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
>   $ gcc -v |& tail -1
>   gcc version 13.2.1 20231205 (Red Hat 13.2.1-6) (GCC)
>   $
> 
> When building in Release mode, for instance by using the buildcmd.sh
> script.
> 
> Cc: Alan Maguire <alan.maguire@xxxxxxxxxx>
> Cc: Eduard Zingerman <eddyz87@xxxxxxxxx>
> Fixes: 7bc9b9975545ab53 ("pahole: Add --btf_features support")
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> ---

Can confirm, warning is fixed by this patch.
strncpy() API is not great :(

Tested-by: Eduard Zingerman <eddyz87@xxxxxxxxx>






[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux