From: Hans Dedecker Date: Sat, 21 Apr 2018 11:40:29 +0000 (+0200) Subject: dhcpv6: fix strncpy bounds X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=327f73dd7093d04c2dbea13ee30fc3dfafc5e944;p=project%2Fodhcp6c.git dhcpv6: fix strncpy bounds Fixes dhcpv6.c:138:2: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation] strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); Signed-off-by: Khem Raj Signed-off-by: Hans Dedecker --- diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 0b3585c..d70d533 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -135,7 +135,7 @@ int init_dhcpv6(const char *ifname, unsigned int options, int sol_timeout) // Detect interface struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0) goto failure;