summaryrefslogtreecommitdiff
path: root/vlan.c
diff options
context:
space:
mode:
authorStijn Tintel <stijn@linux-ipv6.be>2022-12-08 00:57:08 +0200
committerStijn Tintel <stijn@linux-ipv6.be>2022-12-08 00:57:08 +0200
commit02ada7a28b9390625d29aad6308f623df930342a (patch)
tree7a508b08ad81c5976343c7685a1c700ee8e395fd /vlan.c
parent86586994c97ca99d2da57224575d4a28760725e2 (diff)
downloadnetifd-02ada7a28b9390625d29aad6308f623df930342a.tar.gz
treewide: fix use of IFNAMSIZstaging/stintel/ifnamsiz
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>
Diffstat (limited to 'vlan.c')
-rw-r--r--vlan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vlan.c b/vlan.c
index 23b20a9..3d444a9 100644
--- a/vlan.c
+++ b/vlan.c
@@ -128,7 +128,7 @@ static int vlan_set_device_state(struct device *dev, bool up)
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);
@@ -175,7 +175,7 @@ static struct device *get_vlan_device(struct device *dev, char *id_str, bool cre
};
struct vlan_device *vldev;
struct device_user *dep;
- char name[IFNAMSIZ + 1];
+ char name[IFNAMSIZ];
char *err = NULL;
int id, *alias_id;