diff options
Diffstat (limited to 'networking/libiproute/iplink.c')
-rw-r--r-- | networking/libiproute/iplink.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 8de17bf..d3d0338 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -41,7 +41,7 @@ static void do_chflags(char *dev, uint32_t flags, uint32_t mask) struct ifreq ifr; int fd; - strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); + strncpy_IFNAMSIZ(ifr.ifr_name, dev); fd = get_ctl_fd(); xioctl(fd, SIOCGIFFLAGS, &ifr); if ((ifr.ifr_flags ^ flags) & mask) { @@ -58,8 +58,8 @@ static void do_changename(char *dev, char *newdev) struct ifreq ifr; int fd; - strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); - strncpy(ifr.ifr_newname, newdev, sizeof(ifr.ifr_newname)); + strncpy_IFNAMSIZ(ifr.ifr_name, dev); + strncpy_IFNAMSIZ(ifr.ifr_newname, newdev); fd = get_ctl_fd(); xioctl(fd, SIOCSIFNAME, &ifr); close(fd); @@ -73,7 +73,7 @@ static void set_qlen(char *dev, int qlen) s = get_ctl_fd(); memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); + strncpy_IFNAMSIZ(ifr.ifr_name, dev); ifr.ifr_qlen = qlen; xioctl(s, SIOCSIFTXQLEN, &ifr); close(s); @@ -87,7 +87,7 @@ static void set_mtu(char *dev, int mtu) s = get_ctl_fd(); memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); + strncpy_IFNAMSIZ(ifr.ifr_name, dev); ifr.ifr_mtu = mtu; xioctl(s, SIOCSIFMTU, &ifr); close(s); @@ -104,7 +104,7 @@ static int get_address(char *dev, int *htype) s = xsocket(PF_PACKET, SOCK_DGRAM, 0); memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); + strncpy_IFNAMSIZ(ifr.ifr_name, dev); xioctl(s, SIOCGIFINDEX, &ifr); memset(&me, 0, sizeof(me)); @@ -128,7 +128,7 @@ static void parse_address(char *dev, int hatype, int halen, char *lla, struct if int alen; memset(ifr, 0, sizeof(*ifr)); - strncpy(ifr->ifr_name, dev, sizeof(ifr->ifr_name)); + strncpy_IFNAMSIZ(ifr->ifr_name, dev); ifr->ifr_hwaddr.sa_family = hatype; alen = hatype == 1/*ARPHRD_ETHER*/ ? 14/*ETH_HLEN*/ : 19/*INFINIBAND_HLEN*/; |