From 3d5d624919bed2dbb0c49b5fb0e538a47b69aca2 Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 5 Sep 2016 00:36:52 +0000 Subject: 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 --- lib/libc/net/getaddrinfo.c | 2 +- lib/libc/net/name6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index c5bfc5e..ec22570 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -931,7 +931,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 b34580e..38986fc 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; } -- cgit v1.1