int fd;
int err;
- strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, dev, IFNAMSIZ);
fd = get_ctl_fd();
if (fd < 0)
return -1;
int fd;
int err;
- strncpy(ifr.ifr_name, dev, IFNAMSIZ);
- strncpy(ifr.ifr_newname, newdev, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, dev, IFNAMSIZ);
+ strlcpy(ifr.ifr_newname, newdev, IFNAMSIZ);
fd = get_ctl_fd();
if (fd < 0)
return -1;
if (s < 0)
return -1;
- strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, dev, IFNAMSIZ);
if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) {
perror("SIOCSIFXQLEN");
close(s);
if (s < 0)
return -1;
- strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, dev, IFNAMSIZ);
if (ioctl(s, SIOCSIFMTU, &ifr) < 0) {
perror("SIOCSIFMTU");
close(s);
return -1;
}
- strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, dev, IFNAMSIZ);
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
perror("SIOCGIFINDEX");
close(s);
int alen;
memset(ifr, 0, sizeof(*ifr));
- strncpy(ifr->ifr_name, dev, IFNAMSIZ);
+ strlcpy(ifr->ifr_name, dev, IFNAMSIZ);
ifr->ifr_hwaddr.sa_family = hatype;
alen = ll_addr_a2n(ifr->ifr_hwaddr.sa_data, 14, lla);
if (alen < 0)