Fixes
dhcpv6.c:141: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 <raj.k...@gmail.com>
---
 src/dhcpv6.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index e8f32a3..e55b7e1 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -137,7 +137,8 @@ int init_dhcpv6(const char *ifname, unsigned int options, 
int sol_timeout)
 
        // Detect interface
        struct ifreq ifr;
-       strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+       memset(&ifr, 0, sizeof(struct ifreq));
+       strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)-1);
        if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0)
                return -1;
        ifindex = ifr.ifr_ifindex;
-- 
2.17.0


_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to