Bug 212121

Summary: getaddrinfo doesn't compute length for sort rule 9 correctly
Product: Base System Reporter: Herbie.Robinson
Component: binAssignee: Andrey A. Chernov <ache>
Status: Closed FIXED    
Severity: Affects Many People CC: ache
Priority: --- Keywords: patch
Version: CURRENTFlags: ache: mfc-stable11+
ache: mfc-stable10+
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch based on version 304911 in head. none

Description Herbie.Robinson 2016-08-24 19:31:46 UTC
The routine "matchlen" in getaddrinfo contains the following loop:

while (r < addrlen * 8) {

It should be 

while ((r & 0x80) == 0) {

While this bug does, in theory, affect a lot of people, I seriously doubt many of them will notice.
Comment 1 Herbie.Robinson 2016-08-31 13:52:01 UTC
Created attachment 174253 [details]
Patch based on version 304911 in head.
Comment 2 commit-hook freebsd_committer freebsd_triage 2016-08-31 18:50:41 UTC
A commit references this bug:

Author: ache
Date: Wed Aug 31 18:49:50 UTC 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

Changes:
  head/lib/libc/net/getaddrinfo.c
  head/lib/libc/net/name6.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-09-05 00:37:09 UTC
A commit references this bug:

Author: ache
Date: Mon Sep  5 00:36:53 UTC 2016
New revision: 305401
URL: https://svnweb.freebsd.org/changeset/base/305401

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

Changes:
_U  stable/10/
  stable/10/lib/libc/net/getaddrinfo.c
  stable/10/lib/libc/net/name6.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-09-05 00:42:10 UTC
A commit references this bug:

Author: ache
Date: Mon Sep  5 00:41:17 UTC 2016
New revision: 305402
URL: https://svnweb.freebsd.org/changeset/base/305402

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

Changes:
_U  stable/11/
  stable/11/lib/libc/net/getaddrinfo.c
  stable/11/lib/libc/net/name6.c