IFNAMSIZ already includes an extra byte for the null character
terminating the string. Adding an extra byte can cause the interface
name to be truncated, resulting in undefined behaviour.
Drop the extra byte. For the bonding case, the interface name written to
sysfs should be prefixed with + or - so we do need an extra byte.
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
struct vlist_tree vlans;
struct kvlist vlan_aliases;
- char ifname[IFNAMSIZ + 1];
+ char ifname[IFNAMSIZ];
int ifindex;
struct blob_attr *config;
struct interface_user out_iface_user;
/* device name */
- char in_dev[IFNAMSIZ + 1];
- char out_dev[IFNAMSIZ + 1];
+ char in_dev[IFNAMSIZ];
+ char out_dev[IFNAMSIZ];
/* everything below is used as avl tree key */
/* don't change the order */
{
const char *port_name = port->ifname;
const char op_ch = add ? '+' : '-';
- char buf[IFNAMSIZ + 2];
+ char buf[IFNAMSIZ + 1];
snprintf(buf, sizeof(buf), "%c%s", op_ch, port_name);
system_if_down(port);
static void vlan_dev_cb(struct device_user *dep, enum device_event ev)
{
- char name[IFNAMSIZ + 1];
+ char name[IFNAMSIZ];
struct vlan_device *vldev;
vldev = container_of(dep, struct vlan_device, dep);
};
struct vlan_device *vldev;
struct device_user *dep;
- char name[IFNAMSIZ + 1];
+ char name[IFNAMSIZ];
char *err = NULL;
int id, *alias_id;