diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-08 08:42:37 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-14 17:38:40 +0100 |
commit | f5b9a2267803bcb1dad5e902dcdfeefb65a112c3 (patch) | |
tree | cf523d028046012a1da3f7926435e776b438c59c /networking/tc.c | |
parent | 112392232028fa2ce215043e7f9cf78f7ff74afe (diff) | |
download | busybox-w32-f5b9a2267803bcb1dad5e902dcdfeefb65a112c3.tar.gz busybox-w32-f5b9a2267803bcb1dad5e902dcdfeefb65a112c3.tar.bz2 busybox-w32-f5b9a2267803bcb1dad5e902dcdfeefb65a112c3.zip |
ip: fix crash in "ip neigh show"
parse_rtattr() was using tb[] array without initializing it.
Based on patch by Balaji Punnuru <balaji_punnuru@cable.comcast.com>
function old new delta
parse_rtattr 85 107 +22
print_route 1630 1617 -13
print_linkinfo 807 794 -13
iproute_get 835 822 -13
print_rule 680 665 -15
ll_remember_index 263 248 -15
print_addrinfo 1223 1197 -26
ipaddr_list_or_flush 1253 1223 -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/7 up/down: 22/-125) Total: -103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tc.c')
-rw-r--r-- | networking/tc.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/networking/tc.c b/networking/tc.c index 23abf636c..284c93098 100644 --- a/networking/tc.c +++ b/networking/tc.c | |||
@@ -57,17 +57,21 @@ | |||
57 | 57 | ||
58 | /* nullifies tb on error */ | 58 | /* nullifies tb on error */ |
59 | #define __parse_rtattr_nested_compat(tb, max, rta, len) \ | 59 | #define __parse_rtattr_nested_compat(tb, max, rta, len) \ |
60 | ({if ((RTA_PAYLOAD(rta) >= len) && \ | 60 | ({ \ |
61 | (RTA_PAYLOAD(rta) >= RTA_ALIGN(len) + sizeof(struct rtattr))) { \ | 61 | if ((RTA_PAYLOAD(rta) >= len) \ |
62 | rta = RTA_DATA(rta) + RTA_ALIGN(len); \ | 62 | && (RTA_PAYLOAD(rta) >= RTA_ALIGN(len) + sizeof(struct rtattr)) \ |
63 | parse_rtattr_nested(tb, max, rta); \ | 63 | ) { \ |
64 | } else \ | 64 | rta = RTA_DATA(rta) + RTA_ALIGN(len); \ |
65 | memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); \ | 65 | parse_rtattr_nested(tb, max, rta); \ |
66 | }) | 66 | } else \ |
67 | memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); \ | ||
68 | }) | ||
67 | 69 | ||
68 | #define parse_rtattr_nested_compat(tb, max, rta, data, len) \ | 70 | #define parse_rtattr_nested_compat(tb, max, rta, data, len) \ |
69 | ({data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ | 71 | ({ \ |
70 | __parse_rtattr_nested_compat(tb, max, rta, len); }) | 72 | data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ |
73 | __parse_rtattr_nested_compat(tb, max, rta, len); \ | ||
74 | }) | ||
71 | 75 | ||
72 | #define show_details (0) /* not implemented. Does anyone need it? */ | 76 | #define show_details (0) /* not implemented. Does anyone need it? */ |
73 | #define use_iec (0) /* not currently documented in the upstream manpage */ | 77 | #define use_iec (0) /* not currently documented in the upstream manpage */ |