don't allow "" for device name

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>
This commit is contained in:
Stephen Hemminger 2007-10-12 14:43:03 -07:00
parent 550967eecf
commit ba371d9890

View 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);