|
|
049c96 |
From e12035a23d3f12154f4d4034ee88157b86f3b5e3 Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Thu, 18 Feb 2016 13:38:12 +0100
|
|
|
049c96 |
Subject: [PATCH] neighbor: check return values
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1277094
|
|
|
049c96 |
Upstream Status: iproute2.git commit 542b0cc759c6d
|
|
|
049c96 |
|
|
|
049c96 |
commit 542b0cc759c6d3456d16c05c886b367e1b2f1e73
|
|
|
049c96 |
Author: Stephen Hemminger <shemming@brocade.com>
|
|
|
049c96 |
Date: Tue Jan 13 18:06:16 2015 -0800
|
|
|
049c96 |
|
|
|
049c96 |
neighbor: check return values
|
|
|
049c96 |
|
|
|
049c96 |
Need to check for invalid address and buffer overrun in ip neigh
|
|
|
049c96 |
command with invalid paramters.
|
|
|
049c96 |
---
|
|
|
049c96 |
ip/ipneigh.c | 9 +++++++--
|
|
|
049c96 |
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
|
|
|
049c96 |
index 71a4100..c47f005 100644
|
|
|
049c96 |
--- a/ip/ipneigh.c
|
|
|
049c96 |
+++ b/ip/ipneigh.c
|
|
|
049c96 |
@@ -157,14 +157,19 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
|
|
|
049c96 |
exit(-1);
|
|
|
049c96 |
}
|
|
|
049c96 |
req.ndm.ndm_family = dst.family;
|
|
|
049c96 |
- addattr_l(&req.n, sizeof(req), NDA_DST, &dst.data, dst.bytelen);
|
|
|
049c96 |
+ if (addattr_l(&req.n, sizeof(req), NDA_DST, &dst.data, dst.bytelen) < 0)
|
|
|
049c96 |
+ return -1;
|
|
|
049c96 |
|
|
|
049c96 |
if (lla && strcmp(lla, "null")) {
|
|
|
049c96 |
char llabuf[20];
|
|
|
049c96 |
int l;
|
|
|
049c96 |
|
|
|
049c96 |
l = ll_addr_a2n(llabuf, sizeof(llabuf), lla);
|
|
|
049c96 |
- addattr_l(&req.n, sizeof(req), NDA_LLADDR, llabuf, l);
|
|
|
049c96 |
+ if (l < 0)
|
|
|
049c96 |
+ return -1;
|
|
|
049c96 |
+
|
|
|
049c96 |
+ if (addattr_l(&req.n, sizeof(req), NDA_LLADDR, llabuf, l) < 0)
|
|
|
049c96 |
+ return -1;
|
|
|
049c96 |
}
|
|
|
049c96 |
|
|
|
049c96 |
ll_init_map(&rth);
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|