[ipxe-devel] [PATCH 1/1] [efi] avoid stringop-truncation error in util/elf2efi.c

Michael Brown mcb30 at ipxe.org
Thu Aug 23 23:34:04 UTC 2018


On 23/08/18 21:12, Heinrich Schuchardt wrote:
> Avoid the following error with gcc 7.3:
> 
> In function ‘process_section’,
>      inlined from ‘elf2pe.isra.4’ at util/elf2efi.c:914:25:
> util/elf2efi.c:497:2: error: ‘strncpy’ specified bound 8 equals
> destination size [-Werror=stringop-truncation]
>    strncpy ( ( char * ) new->hdr.Name, name, sizeof ( new->hdr.Name ) );
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> The truncation to eight charactres is desired here, so we don't want this
> warning to create an error.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

This should already be fixed by:

   http://git.ipxe.org/ipxe.git/commitdiff/8ed4e3049

Michael



More information about the ipxe-devel mailing list