summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-02-23 05:06:42 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-02-23 05:06:42 +0000
commitb50c8dcb2a4dc1bb7ca91d4d930a94a78ca34b0c (patch)
treec5e6bbe5a81d36c8d8ffffa05b9e62ebd322a581 /sys/netinet6
parent74d0bc48b2645c03bacf296768bc1481c22e24ea (diff)
avoid touching out-of-bound memory if len == 128.
Ted Unangst via Colin Percival
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index b2e52435a55..74244f1efff 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.53 2004/01/13 06:28:16 mcbride Exp $ */
+/* $OpenBSD: in6.c,v 1.54 2004/02/23 05:06:41 itojun Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -2203,7 +2203,8 @@ in6_are_prefix_equal(p1, p2, len)
if (bcmp(&p1->s6_addr, &p2->s6_addr, bytelen))
return (0);
- if (p1->s6_addr[bytelen] >> (8 - bitlen) !=
+ if (bitlen != 0 &&
+ p1->s6_addr[bytelen] >> (8 - bitlen) !=
p2->s6_addr[bytelen] >> (8 - bitlen))
return (0);