summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2016-09-05 00:41:17 +0000
committerache <ache@FreeBSD.org>2016-09-05 00:41:17 +0000
commitd319cd96df894f881c5b334a2d1db5665bd76f56 (patch)
treefedb399fad00621ad26c7e91146fce2eeed48620
parent62c142210bab70088259d242c4fc1ef3d7fb78f8 (diff)
downloadFreeBSD-src-d319cd96df894f881c5b334a2d1db5665bd76f56.zip
FreeBSD-src-d319cd96df894f881c5b334a2d1db5665bd76f56.tar.gz
MFC r305144
'addrlen' does not matter when we need to find the first non-zero bit in the byte from the left and 'addrlen' already counted in 'lim'. PR: 212121 Submitted by: Herbie.Robinson@stratus.com
-rw-r--r--lib/libc/net/getaddrinfo.c2
-rw-r--r--lib/libc/net/name6.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 0d86fe5..f5271c6 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -949,7 +949,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
- while (r < addrlen * 8) {
+ while ((r & 0x80) == 0) {
match++;
r <<= 1;
}
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 7e52a51..b097078 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -930,7 +930,7 @@ matchlen(struct sockaddr *src, struct sockaddr *dst)
while (s < lim)
if ((r = (*d++ ^ *s++)) != 0) {
- while (r < addrlen * 8) {
+ while ((r & 0x80) == 0) {
match++;
r <<= 1;
}
OpenPOWER on IntegriCloud