]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - ip/ipl2tp.c
Check user supplied interface name lengths
[mirror_iproute2.git] / ip / ipl2tp.c
index 88664c909e11f7f6038eedb8d1691f94f0e33a7b..1e37b175e33150fb07239d4fe8e37144afcfd873 100644 (file)
@@ -182,7 +182,7 @@ static int create_session(struct l2tp_parm *p)
        if (p->peer_cookie_len)
                addattr_l(&req.n, 1024, L2TP_ATTR_PEER_COOKIE,
                          p->peer_cookie,  p->peer_cookie_len);
-       if (p->ifname && p->ifname[0])
+       if (p->ifname)
                addattrstrz(&req.n, 1024, L2TP_ATTR_IFNAME, p->ifname);
 
        if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0)
@@ -545,6 +545,8 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
                        }
                } else if (strcmp(*argv, "name") == 0) {
                        NEXT_ARG();
+                       if (check_ifname(*argv))
+                               invarg("\"name\" not a valid ifname", *argv);
                        p->ifname = *argv;
                } else if (strcmp(*argv, "remote") == 0) {
                        NEXT_ARG();