mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-08-15 02:41:32 +00:00
iplink: Process "alias" parameter correctly
Do not stop parameters processing after "alias" parameter: it might not be a last one. Seems copy pasted from "type" parameter code. Check it's length does not exceed IFALIASZ - 1. Better we warn than get RTNL error. Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
b7ea12ae43
commit
f88becf35e
@ -770,11 +770,12 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
break;
|
break;
|
||||||
} else if (matches(*argv, "alias") == 0) {
|
} else if (matches(*argv, "alias") == 0) {
|
||||||
|
len = strlen(*argv);
|
||||||
|
if (len >= IFALIASZ)
|
||||||
|
invarg("alias too long\n", *argv);
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
addattr_l(&req->n, sizeof(*req), IFLA_IFALIAS,
|
addattr_l(&req->n, sizeof(*req), IFLA_IFALIAS,
|
||||||
*argv, strlen(*argv));
|
*argv, len);
|
||||||
argc--; argv++;
|
|
||||||
break;
|
|
||||||
} else if (strcmp(*argv, "group") == 0) {
|
} else if (strcmp(*argv, "group") == 0) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (*group != -1)
|
if (*group != -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user