ip a: fix SEGV if "dev IFACE" is not specified
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
21e8e8da64
commit
fd744519d1
@ -681,7 +681,7 @@ static int ipaddr_modify(int cmd, char **argv)
|
|||||||
} else if (arg == 7) { /* label */
|
} else if (arg == 7) { /* label */
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
l = *argv;
|
l = *argv;
|
||||||
addattr_l(&req.n, sizeof(req), IFA_LABEL, l, strlen(l)+1);
|
addattr_l(&req.n, sizeof(req), IFA_LABEL, l, strlen(l) + 1);
|
||||||
} else {
|
} else {
|
||||||
if (arg == 8) /* local */
|
if (arg == 8) /* local */
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
@ -698,11 +698,10 @@ static int ipaddr_modify(int cmd, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// d cannot be null here, NEXT_ARG() of "dev" ensures that
|
if (!d) {
|
||||||
//if (d == NULL) {
|
/* There was no "dev IFACE", but we need that */
|
||||||
// bb_error_msg(bb_msg_requires_arg, "\"dev\"");
|
bb_error_msg_and_die("need \"dev IFACE\"");
|
||||||
// return -1;
|
}
|
||||||
//}
|
|
||||||
if (l && strncmp(d, l, strlen(d)) != 0) {
|
if (l && strncmp(d, l, strlen(d)) != 0) {
|
||||||
bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s)", d, l);
|
bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s)", d, l);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user