[ipxe-devel] [PATCH] [efi] Use memcpy to handle efi header name

Christian Hesse list at eworm.de
Mon Jun 18 11:55:34 UTC 2018


"Bernhard M. Wiedemann" <bwiedemann at suse.de> on Mon, 2018/06/18 13:43:
> strncpy will copy 8 chars into a buffer of size 8
> which does not leave space for the terminating null byte,
> thus gcc8 failed compilation with
> 
>   In function 'process_section',
>       inlined from 'elf2pe.isra.4' at util/elf2efi.c:913:25:
>   util/elf2efi.c:497:2: error: 'strncpy' specified bound 8 equals
> destination size [-Werror=stringop-truncation]
> 
> It seems hdr.Name is not supposed to be null-terminated,
> so memcpy is more appropriate.

I send an identical patch (except the message of course) on May 15th. And
there were different solutions on the mailing list as well.

Michael, can we commit a fix for this, please?
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20180618/68e65874/attachment.sig>


More information about the ipxe-devel mailing list