summaryrefslogtreecommitdiffstats
path: root/ldpd/ldp_zebra.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-08-19 19:12:20 +0200
committerRenato Westphal <renato@opensourcerouting.org>2017-08-23 22:45:17 +0200
commite959008b1ef36acc572d41555f7df2d3e7f9a0cf (patch)
tree2a7965329514855682fe6159e5922935ba805892 /ldpd/ldp_zebra.c
parentzebra: add support for NEXTHOP_TYPE_IPV6_IFINDEX in zserv (diff)
downloadfrr-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 'ldpd/ldp_zebra.c')
-rw-r--r--ldpd/ldp_zebra.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index ecc7db8f2..54c5af62a 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -427,17 +427,18 @@ ldp_zebra_read_route(int command, struct zclient *zclient, zebra_size_t length,
case ZEBRA_REDISTRIBUTE_IPV4_ADD:
case ZEBRA_REDISTRIBUTE_IPV4_DEL:
kr.af = AF_INET;
+ kr.prefixlen = MIN(IPV4_MAX_PREFIXLEN, stream_getc(s));
nhlen = sizeof(struct in_addr);
break;
case ZEBRA_REDISTRIBUTE_IPV6_ADD:
case ZEBRA_REDISTRIBUTE_IPV6_DEL:
kr.af = AF_INET6;
+ kr.prefixlen = MIN(IPV6_MAX_PREFIXLEN, stream_getc(s));
nhlen = sizeof(struct in6_addr);
break;
default:
fatalx("ldp_zebra_read_route: unknown command");
}
- kr.prefixlen = stream_getc(s);
stream_get(&kr.prefix, s, PSIZE(kr.prefixlen));
if (bad_addr(kr.af, &kr.prefix) ||