Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Aug 2016 18:49:50 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r305144 - head/lib/libc/net
Message-ID:  <201608311849.u7VInone056382@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ache
Date: Wed Aug 31 18:49:50 2016
New Revision: 305144
URL: https://svnweb.freebsd.org/changeset/base/305144

Log:
  '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

Modified:
  head/lib/libc/net/getaddrinfo.c
  head/lib/libc/net/name6.c

Modified: head/lib/libc/net/getaddrinfo.c
==============================================================================
--- head/lib/libc/net/getaddrinfo.c	Wed Aug 31 18:37:51 2016	(r305143)
+++ head/lib/libc/net/getaddrinfo.c	Wed Aug 31 18:49:50 2016	(r305144)
@@ -949,7 +949,7 @@ matchlen(struct sockaddr *src, struct so
 
 	while (s < lim)
 		if ((r = (*d++ ^ *s++)) != 0) {
-			while (r < addrlen * 8) {
+			while ((r & 0x80) == 0) {
 				match++;
 				r <<= 1;
 			}

Modified: head/lib/libc/net/name6.c
==============================================================================
--- head/lib/libc/net/name6.c	Wed Aug 31 18:37:51 2016	(r305143)
+++ head/lib/libc/net/name6.c	Wed Aug 31 18:49:50 2016	(r305144)
@@ -930,7 +930,7 @@ matchlen(struct sockaddr *src, struct so
 
 	while (s < lim)
 		if ((r = (*d++ ^ *s++)) != 0) {
-			while (r < addrlen * 8) {
+			while ((r & 0x80) == 0) {
 				match++;
 				r <<= 1;
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608311849.u7VInone056382>