From owner-svn-src-all@freebsd.org Wed Aug 31 18:49:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FFB8BC9AF7; Wed, 31 Aug 2016 18:49:51 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52FF4AEA; Wed, 31 Aug 2016 18:49:51 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7VInogU056384; Wed, 31 Aug 2016 18:49:50 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7VInone056382; Wed, 31 Aug 2016 18:49:50 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201608311849.u7VInone056382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 31 Aug 2016 18:49:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305144 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 18:49:51 -0000 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; }