|
|
1feee8 |
commit c36e7cca3571b0c92b09409c1df86a142596c210
|
|
|
1feee8 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
1feee8 |
Date: Tue Aug 30 10:02:49 2022 +0200
|
|
|
1feee8 |
|
|
|
1feee8 |
nss_dns: In gaih_getanswer_slice, skip strange aliases (bug 12154)
|
|
|
1feee8 |
|
|
|
1feee8 |
If the name is not a host name, skip adding it to the result, instead
|
|
|
1feee8 |
of reporting query failure. This fixes bug 12154 for getaddrinfo.
|
|
|
1feee8 |
|
|
|
1feee8 |
This commit still keeps the old parsing code, and only adjusts when
|
|
|
1feee8 |
a host name is copied.
|
|
|
1feee8 |
|
|
|
1feee8 |
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
|
|
1feee8 |
(cherry picked from commit 32b599ac8c21c4c332cc3900a792a1395bca79c7)
|
|
|
1feee8 |
|
|
|
1feee8 |
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
|
|
|
1feee8 |
index 10c21e1e827cde12..1cb3be71f04d98eb 100644
|
|
|
1feee8 |
--- a/resolv/nss_dns/dns-host.c
|
|
|
1feee8 |
+++ b/resolv/nss_dns/dns-host.c
|
|
|
1feee8 |
@@ -971,12 +971,12 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
|
|
|
1feee8 |
|
|
|
1feee8 |
n = -1;
|
|
|
1feee8 |
}
|
|
|
1feee8 |
- if (__glibc_unlikely (n < 0 || __libc_res_hnok (buffer) == 0))
|
|
|
1feee8 |
+ if (__glibc_unlikely (n < 0))
|
|
|
1feee8 |
{
|
|
|
1feee8 |
++had_error;
|
|
|
1feee8 |
continue;
|
|
|
1feee8 |
}
|
|
|
1feee8 |
- if (*firstp && canon == NULL)
|
|
|
1feee8 |
+ if (*firstp && canon == NULL && __libc_res_hnok (buffer))
|
|
|
1feee8 |
{
|
|
|
1feee8 |
h_name = buffer;
|
|
|
1feee8 |
buffer += h_namelen;
|
|
|
1feee8 |
@@ -1022,14 +1022,14 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
|
|
|
1feee8 |
|
|
|
1feee8 |
n = __libc_dn_expand (answer->buf, end_of_message, cp,
|
|
|
1feee8 |
tbuf, sizeof tbuf);
|
|
|
1feee8 |
- if (__glibc_unlikely (n < 0 || __libc_res_hnok (tbuf) == 0))
|
|
|
1feee8 |
+ if (__glibc_unlikely (n < 0))
|
|
|
1feee8 |
{
|
|
|
1feee8 |
++had_error;
|
|
|
1feee8 |
continue;
|
|
|
1feee8 |
}
|
|
|
1feee8 |
cp += n;
|
|
|
1feee8 |
|
|
|
1feee8 |
- if (*firstp)
|
|
|
1feee8 |
+ if (*firstp && __libc_res_hnok (tbuf))
|
|
|
1feee8 |
{
|
|
|
1feee8 |
/* Reclaim buffer space. */
|
|
|
1feee8 |
if (h_name + h_namelen == buffer)
|