Commit 542b0cc7 authored by Stephen Hemminger's avatar Stephen Hemminger

neighbor: check return values

Need to check for invalid address and buffer overrun in ip neigh
command with invalid paramters.
parent c3087c10
......@@ -157,14 +157,19 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
exit(-1);
}
req.ndm.ndm_family = dst.family;
addattr_l(&req.n, sizeof(req), NDA_DST, &dst.data, dst.bytelen);
if (addattr_l(&req.n, sizeof(req), NDA_DST, &dst.data, dst.bytelen) < 0)
return -1;
if (lla && strcmp(lla, "null")) {
char llabuf[20];
int l;
l = ll_addr_a2n(llabuf, sizeof(llabuf), lla);
addattr_l(&req.n, sizeof(req), NDA_LLADDR, llabuf, l);
if (l < 0)
return -1;
if (addattr_l(&req.n, sizeof(req), NDA_LLADDR, llabuf, l) < 0)
return -1;
}
ll_init_map(&rth);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment