summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_rib.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-12-12 10:30:34 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-12-12 10:30:34 +0000
commitf37e5cd2c5e59da958468ec19d994069d172e1a0 (patch)
treea3206fc871944f8ef2ebcb3b2399e1bf065dd2a8 /usr.sbin/bgpd/rde_rib.c
parentb13a9e99dbc21610a77a6f617153e96ad3ee41e5 (diff)
Even IPv6 has a prefixlen limit. This ensures that we do not overflow the
struct in6_addr later on. OK henning@
Diffstat (limited to 'usr.sbin/bgpd/rde_rib.c')
-rw-r--r--usr.sbin/bgpd/rde_rib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index f8c1cded341..6da515a03f7 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.89 2006/12/12 10:26:47 claudio Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.90 2006/12/12 10:30:33 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -391,6 +391,8 @@ prefix_compare(const struct bgpd_addr *a, const struct bgpd_addr *b,
return (aa - ba);
return (0);
case AF_INET6:
+ if (prefixlen > 128)
+ fatalx("prefix_cmp: bad IPv6 prefixlen");
for (i = 0; i < prefixlen / 8; i++)
if (a->v6.s6_addr[i] != b->v6.s6_addr[i])
return (a->v6.s6_addr[i] - b->v6.s6_addr[i]);