Fix a possible out-of-bounds access in function ifdown(): ifdown.c: In function 'ifdown': ifdown.c:56:4: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation] 56 | strncpy(ifr.ifr_name, ifp->if_name, IFNAMSIZ); Signed-off-by: Helge Deller <deller@xxxxxx> diff --git a/kexec/ifdown.c b/kexec/ifdown.c index 9679ad7..3ac19c1 100644 --- a/kexec/ifdown.c +++ b/kexec/ifdown.c @@ -53,7 +53,8 @@ int ifdown(void) if (strchr(ifp->if_name, ':') != NULL) continue; - strncpy(ifr.ifr_name, ifp->if_name, IFNAMSIZ); + strncpy(ifr.ifr_name, ifp->if_name, IFNAMSIZ-1); + ifr.ifr_name[IFNAMSIZ-1] = 0; if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) { fprintf(stderr, "ifdown: shutdown "); perror(ifp->if_name); _______________________________________________ kexec mailing list kexec@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/kexec