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-08 08:42:37 +0100 |
commit | 68ae54243cacee6beeb69842c7d562435acd5ad1 (patch) | |
tree | 0991e9bfa88bcdff63be362ad62627aacf532b37 /networking/libiproute/ipaddress.c | |
parent | 237a900bc5654c865298b33a70dee60e2cd05dbc (diff) | |
download | busybox-w32-68ae54243cacee6beeb69842c7d562435acd5ad1.tar.gz busybox-w32-68ae54243cacee6beeb69842c7d562435acd5ad1.tar.bz2 busybox-w32-68ae54243cacee6beeb69842c7d562435acd5ad1.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/libiproute/ipaddress.c')
-rw-r--r-- | networking/libiproute/ipaddress.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 921ecf0d9..d7f888176 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -113,7 +113,7 @@ static NOINLINE int print_linkinfo(const struct nlmsghdr *n) | |||
113 | if (G_filter.up && !(ifi->ifi_flags & IFF_UP)) | 113 | if (G_filter.up && !(ifi->ifi_flags & IFF_UP)) |
114 | return 0; | 114 | return 0; |
115 | 115 | ||
116 | memset(tb, 0, sizeof(tb)); | 116 | //memset(tb, 0, sizeof(tb)); - parse_rtattr does this |
117 | parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); | 117 | parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); |
118 | if (tb[IFLA_IFNAME] == NULL) { | 118 | if (tb[IFLA_IFNAME] == NULL) { |
119 | bb_error_msg("nil ifname"); | 119 | bb_error_msg("nil ifname"); |
@@ -227,7 +227,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM, | |||
227 | if (G_filter.flushb && n->nlmsg_type != RTM_NEWADDR) | 227 | if (G_filter.flushb && n->nlmsg_type != RTM_NEWADDR) |
228 | return 0; | 228 | return 0; |
229 | 229 | ||
230 | memset(rta_tb, 0, sizeof(rta_tb)); | 230 | //memset(rta_tb, 0, sizeof(rta_tb)); - parse_rtattr does this |
231 | parse_rtattr(rta_tb, IFA_MAX, IFA_RTA(ifa), n->nlmsg_len - NLMSG_LENGTH(sizeof(*ifa))); | 231 | parse_rtattr(rta_tb, IFA_MAX, IFA_RTA(ifa), n->nlmsg_len - NLMSG_LENGTH(sizeof(*ifa))); |
232 | 232 | ||
233 | if (!rta_tb[IFA_LOCAL]) | 233 | if (!rta_tb[IFA_LOCAL]) |
@@ -535,7 +535,7 @@ int FAST_FUNC ipaddr_list_or_flush(char **argv, int flush) | |||
535 | continue; | 535 | continue; |
536 | if (G_filter.pfx.family || G_filter.label) { | 536 | if (G_filter.pfx.family || G_filter.label) { |
537 | struct rtattr *tb[IFA_MAX+1]; | 537 | struct rtattr *tb[IFA_MAX+1]; |
538 | memset(tb, 0, sizeof(tb)); | 538 | //memset(tb, 0, sizeof(tb)); - parse_rtattr does this |
539 | parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), IFA_PAYLOAD(n)); | 539 | parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), IFA_PAYLOAD(n)); |
540 | if (!tb[IFA_LOCAL]) | 540 | if (!tb[IFA_LOCAL]) |
541 | tb[IFA_LOCAL] = tb[IFA_ADDRESS]; | 541 | tb[IFA_LOCAL] = tb[IFA_ADDRESS]; |