The warning only seems to be for line 369, so why change more than that? Also, what value does sizeof(tag.information1[0]) give?
On 6/22/11 3:56 AM, Alexey I. Froloff wrote: > When host gcc uses _FORTIFY_SOURCE=2 by default, tools/firmware-utils > fails to compile: > > In file included from /usr/include/string.h:658:0, > from src/imagetag.c:12: > In function 'strncpy', > inlined from 'tagfile' at src/imagetag.c:369:11: > /usr/include/bits/string3.h:123:3: error: call to __builtin___strncpy_chk > will always overflow destination buffer > > Signed-off-by: Alexey I. Froloff <[email protected]> > --- > tools/firmware-utils/src/imagetag.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/firmware-utils/src/imagetag.c > b/tools/firmware-utils/src/imagetag.c > index bebaba2..cfe7cf4 100644 > --- a/tools/firmware-utils/src/imagetag.c > +++ b/tools/firmware-utils/src/imagetag.c > @@ -362,11 +362,11 @@ int tagfile(const char *kernel, const char *rootfs, > const char *bin, \ > } > > if (args->reserved2_given) { > - strncpy(tag.reserved2, args->reserved2_arg, 16); > + memcpy(tag.reserved2, args->reserved2_arg, 16); > } > > if (args->altinfo_given) { > - strncpy(&tag.information1[0], args->altinfo_arg, ALTTAGINFO_LEN); > + memcpy(&tag.information1[0], args->altinfo_arg, ALTTAGINFO_LEN); > } > > if (args->second_image_flag_given) { _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
