]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
don't allow "" for device name
authorStephen Hemminger <shemminger@linux-foundation.org>
Fri, 12 Oct 2007 21:43:03 +0000 (14:43 -0700)
committerStephen Hemminger <shemminger@linux-foundation.org>
Fri, 12 Oct 2007 21:43:03 +0000 (14:43 -0700)
If a zero-length string is given, it is not rejected by
netlink in kernel so catch it at command line.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
ip/iplink.c

index 4060845cc8b78596504b68d33c87c7466396c504..82275b4e19646c7c6fc1d290b2e53de2aa0a1e6f 100644 (file)
@@ -336,6 +336,8 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
 
        if (name) {
                len = strlen(name) + 1;
+               if (len == 1)
+                       invarg("null string is not valid name\n");
                if (len > IFNAMSIZ)
                        invarg("\"name\" too long\n", *argv);
                addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, len);