summaryrefslogtreecommitdiff
path: root/backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-08-03 06:28:41 +0000
committerCoprDistGit <infra@openeuler.org>2024-08-03 06:28:41 +0000
commitd20db0561a6a36f914fde030512503b114ef9a0c (patch)
treed4e5e3494d95c269a1cee6195f11bf3201bcadbf /backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch
parent016343d99b1b269d7246ef1e143d4b54914433d4 (diff)
Diffstat (limited to 'backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch')
-rw-r--r--backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch b/backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch
new file mode 100644
index 0000000..73ae2ec
--- /dev/null
+++ b/backport-nss_dns-In-gaih_getanswer_slice-skip-strange-aliases-bug-12154.patch
@@ -0,0 +1,58 @@
+From 32b599ac8c21c4c332cc3900a792a1395bca79c7 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Tue, 30 Aug 2022 10:02:49 +0200
+Subject: [PATCH] nss_dns: In gaih_getanswer_slice, skip strange aliases (bug
+ 12154)
+
+If the name is not a host name, skip adding it to the result, instead
+of reporting query failure. This fixes bug 12154 for getaddrinfo.
+
+This commit still keeps the old parsing code, and only adjusts when
+a host name is copied.
+
+Conflict: NA
+Reference: https://sourceware.org/git/?p=glibc.git;a=commit;h=32b599ac8c21c4c332cc3900a792a1395bca79c7
+
+Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
+---
+ resolv/nss_dns/dns-host.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
+index b887e77e9c..bea505d697 100644
+--- a/resolv/nss_dns/dns-host.c
++++ b/resolv/nss_dns/dns-host.c
+@@ -970,12 +970,12 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
+
+ n = -1;
+ }
+- if (__glibc_unlikely (n < 0 || __libc_res_hnok (buffer) == 0))
++ if (__glibc_unlikely (n < 0))
+ {
+ ++had_error;
+ continue;
+ }
+- if (*firstp && canon == NULL)
++ if (*firstp && canon == NULL && __libc_res_hnok (buffer))
+ {
+ h_name = buffer;
+ buffer += h_namelen;
+@@ -1021,14 +1021,14 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
+
+ n = __libc_dn_expand (answer->buf, end_of_message, cp,
+ tbuf, sizeof tbuf);
+- if (__glibc_unlikely (n < 0 || __libc_res_hnok (tbuf) == 0))
++ if (__glibc_unlikely (n < 0))
+ {
+ ++had_error;
+ continue;
+ }
+ cp += n;
+
+- if (*firstp)
++ if (*firstp && __libc_res_hnok (tbuf))
+ {
+ /* Reclaim buffer space. */
+ if (h_name + h_namelen == buffer)
+--
+2.23.0