Bug 211790 - Uninitialized Variable in getaddrinfo
Summary: Uninitialized Variable in getaddrinfo
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Enji Cooper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-12 18:52 UTC by Herbie.Robinson
Modified: 2016-08-29 07:47 UTC (History)
3 users (show)

See Also:
ngie: mfc-stable11+
ngie: mfc-stable10+
ngie: mfc-stable9+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Herbie.Robinson 2016-08-12 18:52:43 UTC
The variable "ai" in _dns_getaddrinfo (in getaddrinfo.c) needs to be initialized to NULL.  This was introduced by revision 282444 in the current branch and has been pushed into stable/9.  Didn't check stable/10.
Comment 1 Herbie.Robinson 2016-08-12 18:54:02 UTC
The affect of this will be to return too many addresses in some cases; so, it's not as bad as one might first think.
Comment 2 Enji Cooper freebsd_committer freebsd_triage 2016-08-12 22:06:15 UTC
(In reply to Herbie.Robinson from comment #0)

The revision was r292444; not r282444.

CCing ume@ -- will check this over really quickly to see how easy it would be to fix this/see if there are any Coverity CIDs for it.
Comment 3 Enji Cooper freebsd_committer freebsd_triage 2016-08-12 22:46:15 UTC
It's passed lib/libc/nss/... so far. Working on lib/libc/resolv/... and lib/libthr/resolv_test and will run some more tests tonight. Need to verify with gcc/gcc 5.3.0 as well to make sure building libc there is still ok.
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-08-13 02:05:20 UTC
A commit references this bug:

Author: ngie
Date: Sat Aug 13 02:05:07 UTC 2016
New revision: 304034
URL: https://svnweb.freebsd.org/changeset/base/304034

Log:
  Initialize `ai` to NULL and test for `ai` with type-appropriate values

  Depending on the address family and ai_flags containing AI_V4MAPPED,
  it might not do a proper DNS lookup on the provided DNS address

  Convert some `ai` boolean true/false checks to NULL/non-NULL while here.

  MFC after:	1 week
  PR:		211790
  Reported by:	Herbie.Robinson@stratus.com
  Sponsored by:	EMC / Isilon Storage Division

Changes:
  head/lib/libc/net/getaddrinfo.c
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-08-28 07:08:36 UTC
A commit references this bug:

Author: ngie
Date: Sun Aug 28 07:08:30 UTC 2016
New revision: 304945
URL: https://svnweb.freebsd.org/changeset/base/304945

Log:
  MFC r304034:

  Initialize `ai` to NULL and test for `ai` with type-appropriate values

  Depending on the address family and ai_flags containing AI_V4MAPPED,
  it might not do a proper DNS lookup on the provided DNS address

  Convert some `ai` boolean true/false checks to NULL/non-NULL while here.

  PR:		211790

Changes:
_U  stable/11/
  stable/11/lib/libc/net/getaddrinfo.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-08-29 05:47:22 UTC
A commit references this bug:

Author: ngie
Date: Mon Aug 29 05:46:36 UTC 2016
New revision: 304982
URL: https://svnweb.freebsd.org/changeset/base/304982

Log:
  MFstable/11 r304945:

  MFC r304034:

  Initialize `ai` to NULL and test for `ai` with type-appropriate values

  Depending on the address family and ai_flags containing AI_V4MAPPED,
  it might not do a proper DNS lookup on the provided DNS address

  Convert some `ai` boolean true/false checks to NULL/non-NULL while here.

  PR:		211790

Changes:
_U  stable/10/
  stable/10/lib/libc/net/getaddrinfo.c
Comment 7 commit-hook freebsd_committer freebsd_triage 2016-08-29 07:46:34 UTC
A commit references this bug:

Author: ngie
Date: Mon Aug 29 07:46:24 UTC 2016
New revision: 304990
URL: https://svnweb.freebsd.org/changeset/base/304990

Log:
  MFstable/10 r304982:

  MFstable/11 r304945:

  MFC r304034:

  Initialize `ai` to NULL and test for `ai` with type-appropriate values

  Depending on the address family and ai_flags containing AI_V4MAPPED,
  it might not do a proper DNS lookup on the provided DNS address

  Convert some `ai` boolean true/false checks to NULL/non-NULL while here.

  PR:		211790

Changes:
_U  stable/9/
_U  stable/9/lib/
_U  stable/9/lib/libc/
  stable/9/lib/libc/net/getaddrinfo.c