public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
* [2.25 COMMITTED] getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]
@ 2018-01-01  0:00 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2018-01-01  0:00 UTC (permalink / raw)
  To: libc-stable

(cherry picked from commit 5f8340f583fe3d4f5734bd2371c5a45ecff2db0d)

2017-09-01  Florian Weimer  <fweimer@redhat.com>

	[BZ #21922]
	* sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error
	coming from gethostbyname2_r.

diff --git a/NEWS b/NEWS
index 6bb7dfcf42..d2636b75bd 100644
--- a/NEWS
+++ b/NEWS
@@ -57,6 +57,7 @@ The following bugs are resolved with this release:
   [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366)
   [21654] nss: Fix invalid cast in group merging
   [21778] Robust mutex may deadlock
+  [21922] getaddrinfo with AF_INET(6) returns EAI_NONAME, not EAI_NODATA
   [21972] assert macro requires operator== (int) for its argument type
   [22322] libc: [mips64] wrong bits/long-double.h installed
   [22627] $ORIGIN in $LD_LIBRARY_PATH is substituted twice
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 668f7b7507..bcd437c022 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -613,6 +613,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
 			}
 		      *pat = addrmem;
 		    }
+		  else
+		    {
+		      if (h_errno == NO_DATA)
+			result = -EAI_NODATA;
+		      else
+			result = -EAI_NONAME;
+		      goto free_and_return;
+		    }
 		}
 	      else
 		{

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-04 12:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-01  0:00 [2.25 COMMITTED] getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922] Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).