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 <ra...@altlinux.org>
---
 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) {
-- 
1.7.3.4

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to