glibc/glibc-rh168253-getaddrinfo-h_errno-no-success.patch
Florian Weimer 8597553f96 Rebase DNS stub resolver to the glibc 2.26 version
- Support an arbitrary number of search domains (#168253)
- Detect and apply /etc/resolv.conf changes in libresolv (#1374239)
- CVE-2015-5180: DNS stub resolver crash with crafted record type (#1251403)
2017-10-11 14:41:27 +02:00

28 lines
1.0 KiB
Diff

commit 7ab87bccb657b02cac5a3360b11c67aff901de2e
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Sep 1 08:57:52 2017 +0200
getaddrinfo: In gaih_inet, use h_errno for certain status values only
h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be
accurate at this point.
(cherry picked from commit a2881ef01450295782b065f2f850f340d5c12c14)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index eaf8bafcf4ede5fe..9d9e7e2bf2a78cbb 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -949,7 +949,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
__resolv_context_enable_inet6 (res_ctx, res_enable_inet6);
__resolv_context_put (res_ctx);
- if (h_errno == NETDB_INTERNAL)
+ /* If we have a failure which sets errno, report it using
+ EAI_SYSTEM. */
+ if ((status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL)
+ && h_errno == NETDB_INTERNAL)
{
result = -EAI_SYSTEM;
goto free_and_return;