summaryrefslogtreecommitdiff
path: root/gaiconf_init-Avoid-double-free-in-label-and-preceden.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gaiconf_init-Avoid-double-free-in-label-and-preceden.patch')
-rw-r--r--gaiconf_init-Avoid-double-free-in-label-and-preceden.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/gaiconf_init-Avoid-double-free-in-label-and-preceden.patch b/gaiconf_init-Avoid-double-free-in-label-and-preceden.patch
new file mode 100644
index 0000000..7ebc183
--- /dev/null
+++ b/gaiconf_init-Avoid-double-free-in-label-and-preceden.patch
@@ -0,0 +1,36 @@
+From 77a34079d8f3d63b61543bf3af93043f8674e4c4 Mon Sep 17 00:00:00 2001
+From: Siddhesh Poyarekar <siddhesh@sourceware.org>
+Date: Tue, 3 Aug 2021 21:11:03 +0530
+Subject: [PATCH] gaiconf_init: Avoid double-free in label and precedence lists
+
+labellist and precedencelist could get freed a second time if there
+are allocation failures, so set them to NULL to avoid a double-free.
+
+Reviewed-by: Arjun Shankar <arjun@redhat.com>
+---
+ sysdeps/posix/getaddrinfo.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index 838a68f..43dfc67 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -2008,6 +2008,7 @@ gaiconf_init (void)
+ l = l->next;
+ }
+ free_prefixlist (labellist);
++ labellist = NULL;
+
+ /* Sort the entries so that the most specific ones are at
+ the beginning. */
+@@ -2046,6 +2047,7 @@ gaiconf_init (void)
+ l = l->next;
+ }
+ free_prefixlist (precedencelist);
++ precedencelist = NULL;
+
+ /* Sort the entries so that the most specific ones are at
+ the beginning. */
+--
+1.8.3.1
+