From e1ec67bbc99a3c01ed02f565483cef06ccb11166 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 31 Aug 2016 18:49:50 +0000 Subject: [PATCH] '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 MFC after: 7 days --- lib/libc/net/getaddrinfo.c | 2 +- lib/libc/net/name6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 0d86fe54bb0..f5271c6d5a3 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 7e52a515019..b0970786dd8 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; }