]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]
authorFlorian Weimer <fweimer@redhat.com>
Mon, 4 Sep 2017 09:25:34 +0000 (11:25 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 4 Jan 2018 11:00:15 +0000 (12:00 +0100)
(cherry picked from commit 5f8340f583fe3d4f5734bd2371c5a45ecff2db0d)

ChangeLog
NEWS
sysdeps/posix/getaddrinfo.c

index 410d132f284adfebadf0eddc1f000649b3768675..519e56e8b31a2ae2bcc122f514bd47490092070d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-01  Florian Weimer  <fweimer@redhat.com>
+
+       [BZ #21922]
+       * sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error
+       coming from gethostbyname2_r.
+
 2017-09-01  Florian Weimer  <fweimer@redhat.com>
 
        * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if
diff --git a/NEWS b/NEWS
index 6bb7dfcf4287b1967b9daca5660d1c9f051ca9ed..d2636b75bdabe8de4f094b1c743418910ce36eda 100644 (file)
--- 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
index 668f7b750796d869493afbdc3b6d03e8d97a5eb2..bcd437c0223b4a1c9f655faed4682168ba47fada 100644 (file)
@@ -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
                {