iplink: Fix "alias" parameter length calculations

We need NEXT_ARG() to get *argv pointing to "alias"
parameter value. Overwise we get and check "alias"
string length.

Fixes: f88becf35e ("iplink: Process "alias" parameter correctly")
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Serhey Popovych 2018-01-18 16:24:40 +02:00 committed by Stephen Hemminger
parent c7db3921ec
commit c4fb35bdfc
1 changed files with 1 additions and 1 deletions

View File

@ -778,10 +778,10 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
argc--; argv++;
break;
} else if (matches(*argv, "alias") == 0) {
NEXT_ARG();
len = strlen(*argv);
if (len >= IFALIASZ)
invarg("alias too long\n", *argv);
NEXT_ARG();
addattr_l(&req->n, sizeof(*req), IFLA_IFALIAS,
*argv, len);
} else if (strcmp(*argv, "group") == 0) {