netifd: make sure the vlan ifname fits into the buffer
authorJohn Crispin <john@phrozen.org>
Mon, 16 Jul 2018 08:32:08 +0000 (10:32 +0200)
committerJohn Crispin <john@phrozen.org>
Fri, 27 Jul 2018 07:22:32 +0000 (09:22 +0200)
Signed-off-by: John Crispin <john@phrozen.org>
vlan.c

diff --git a/vlan.c b/vlan.c
index 221c79c8694e9fa00558e12502f585df37a2e428..c3ab2d23f34c5d8f088aecad181ff560fc5fd3da 100644 (file)
--- a/vlan.c
+++ b/vlan.c
@@ -106,6 +106,9 @@ static struct device *get_vlan_device(struct device *dev, int id, bool create)
        struct vlan_device *vldev;
        struct device_user *dep;
 
+       if (strlen(dev->ifname) > (IFNAMSIZ - 6))
+               return NULL;
+
        /* look for an existing interface before creating a new one */
        list_for_each_entry(dep, &dev->users.list, list.list) {
                if (dep->cb != vlan_dev_cb)