diff options
author | Phil Sutter <phil@nwl.cc> | 2018-09-06 15:31:51 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2018-09-10 12:14:50 -0700 |
commit | bd59e5b1517b09b6f26d59f38fe6077d953c2396 (patch) | |
tree | 2da95580aafab2d63b26ef32adf93a17a60e743d /tc/tc.c | |
parent | 40c2916fda23bc9bd124009934544d3c0fddd1c0 (diff) |
ip-route: Fix segfault with many nexthops
It was possible to crash ip-route by adding an IPv6 route with 37
nexthop statements. A simple reproducer is:
| for i in `seq 37`; do
| nhs="nexthop via 1111::$i "$nhs
| done
| ip -6 route add 3333::/64 $nhs
The related code was broken in multiple ways:
* parse_one_nh() assumed that rta points to 4kB of storage but caller
provided just 1kB. Fixed by passing 'len' parameter with the correct
value.
* Error checking of rta_addattr*() calls in parse_one_nh() and called
functions was completely absent, so with above fix in place output
flood would occur due to parser looping forever.
While being at it, increase message buffer sizes to 4k. This allows for
at most 144 nexthops.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'tc/tc.c')
0 files changed, 0 insertions, 0 deletions