On Tue, Aug 23, 2022 at 03:59:07PM +1000, Joel Stanley wrote:

> When building with GCC 12:
> 
> ../include/image.h:779:9: warning: ‘strncpy’ specified bound 32 equals 
> destination size [-Wstringop-truncation]
>   779 |         strncpy(image_get_name(hdr), name, IH_NMLEN);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Ensure the copied string is null terminated by always setting the final
> byte to 0. Shorten the strncpy to IH_NMLEN-1 as we will always overwrite
> the last byte.
> 
> We can't use strlcpy as this is code is built on the host as well as the
> target.
> 
> Fixes: b97a2a0a21f2 ("[new uImage] Define a API for image handling 
> operations")
> Signed-off-by: Joel Stanley <j...@jms.id.au>

So this breaks some tests:
https://source.denx.de/u-boot/u-boot/-/jobs/496773#L201
and it's not clear to me if the problem is the tests or the fix itself
(should we be doing a buffer of IH_NMLEN+1 and ensuring that's NULL
terminated? I don't know).

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to