struct rtattr *attr;
unsigned int mtu;
uint8_t ifaddr[6];
- char ifname[IFNAMSIZ+1];
+ char ifname[IFNAMSIZ];
int attrlen, type;
case IFLA_IFNAME:
strncpy(ifname, data, IFNAMSIZ);
+ ifname[IFNAMSIZ - 1] = '\0';
have_ifname = true;
break;
interface->ifindex = info->ifi_index;
interface->state = IFSTATE_NEW;
memcpy(interface->hwaddr, ifaddr, sizeof(interface->hwaddr));
- strncpy(interface->name, ifname, sizeof(interface->name) - 1);
+ strncpy(interface->name, ifname, sizeof(interface->name));
list_for_each_entry(&network->interfaces, tmp, list)
if (memcmp(interface->hwaddr, tmp->hwaddr,
/* A repeated RTM_NEWLINK can represent an interface name change */
if (strncmp(interface->name, ifname, IFNAMSIZ)) {
pb_debug("ifname update: %s -> %s\n", interface->name, ifname);
- strncpy(interface->name, ifname, sizeof(interface->name) - 1);
+ strncpy(interface->name, ifname, sizeof(interface->name));
talloc_free(interface->dev->device->id);
interface->dev->device->id =
talloc_strdup(interface->dev->device, ifname);