ifr.ifr_ifindex = dev->ifindex;
else
ifr.ifr_data = data;
- strncpy(ifr.ifr_name, bridge, sizeof(ifr.ifr_name));
+ strncpy(ifr.ifr_name, bridge, sizeof(ifr.ifr_name) - 1);
return ioctl(sock_ioctl, cmd, &ifr);
}
int system_if_resolve(struct device *dev)
{
struct ifreq ifr;
- strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name));
+ strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
if (!ioctl(sock_ioctl, SIOCGIFINDEX, &ifr))
return ifr.ifr_ifindex;
else
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_ioctl, SIOCGIFFLAGS, &ifr) < 0)
return -1;
char buf[10];
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name));
+ strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
if (ioctl(sock_ioctl, SIOCGIFMTU, &ifr) == 0) {
s->mtu = ifr.ifr_mtu;
char buf[12];
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name));
+ strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
if (s->flags & DEV_OPT_MTU & apply_mask) {
ifr.ifr_mtu = s->mtu;
if (ioctl(sock_ioctl, SIOCSIFMTU, &ifr) < 0)
memset(&ecmd, 0, sizeof(ecmd));
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name));
+ strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
ifr.ifr_data = (caddr_t) &ecmd;
ecmd.cmd = ETHTOOL_GSET;
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+ strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name) - 1);
ifr.ifr_ifru.ifru_data = p;
return ioctl(sock_ioctl, cmd, &ifr);
}
if (p.iph.ttl && p.iph.frag_off == 0)
return -EINVAL;
- strncpy(p.name, name, sizeof(p.name));
+ strncpy(p.name, name, sizeof(p.name) - 1);
switch (p.iph.protocol) {
case IPPROTO_IPIP: