]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/rp-pppoe/pppoe-discovery.c
Various fixes for errors found by coverity static analysis (#109)
[ppp.git] / pppd / plugins / rp-pppoe / pppoe-discovery.c
index bce71fce04f459b02053cba4c4d95b10a0206f4b..5afb037a1c74c74448851f6c75a1218810a912db 100644 (file)
@@ -181,7 +181,8 @@ openInterface(char const *ifname, UINT16_t type, unsigned char *hwaddr)
     sa.sll_family = AF_PACKET;
     sa.sll_protocol = htons(type);
 
-    strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+    strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
+    ifr.ifr_name[IFNAMSIZ - 1] = 0;
     if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) {
        fatalSys("ioctl(SIOCFIGINDEX): Could not get interface index");
     }