diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-08-19 19:12:20 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-08-23 22:45:17 +0200 |
commit | e959008b1ef36acc572d41555f7df2d3e7f9a0cf (patch) | |
tree | 2a7965329514855682fe6159e5922935ba805892 /nhrpd | |
parent | zebra: add support for NEXTHOP_TYPE_IPV6_IFINDEX in zserv (diff) | |
download | frr-e959008b1ef36acc572d41555f7df2d3e7f9a0cf.tar.xz frr-e959008b1ef36acc572d41555f7df2d3e7f9a0cf.zip |
babeld/eigrpd/ldpd/nhrpd: add prefix length sanity checks
Pulled from d917882.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'nhrpd')
-rw-r--r-- | nhrpd/nhrp_route.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index e9651adc5..5116ad068 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -215,16 +215,17 @@ int nhrp_route_read(int cmd, struct zclient *zclient, zebra_size_t length, vrf_i case ZEBRA_REDISTRIBUTE_IPV4_ADD: case ZEBRA_REDISTRIBUTE_IPV4_DEL: prefix.family = AF_INET; + prefix.prefixlen = MIN(IPV4_MAX_PREFIXLEN, stream_getc(s)); break; case ZEBRA_REDISTRIBUTE_IPV6_ADD: case ZEBRA_REDISTRIBUTE_IPV6_DEL: prefix.family = AF_INET6; + prefix.prefixlen = MIN(IPV6_MAX_PREFIXLEN, stream_getc(s)); break; default: return -1; } afaddrlen = family2addrsize(prefix.family); - prefix.prefixlen = stream_getc(s); stream_get(&prefix.u.val, s, PSIZE(prefix.prefixlen)); memset(&src_p, 0, sizeof(src_p)); |