summaryrefslogtreecommitdiff
path: root/libre/xtensa-unknown-elf-glibc/glibc-2.17-getaddrinfo-stack-overflow.patch
diff options
context:
space:
mode:
authorMárcio Alexandre Silva Delgado <coadde@lavabit.com>2013-07-02 21:04:01 -0300
committerMárcio Alexandre Silva Delgado <coadde@lavabit.com>2013-07-02 21:04:01 -0300
commit0ebb087df0decfe020c909e249f86e1bd5628d22 (patch)
tree409ded8acfc32236a01cfd09164188cd7050ba72 /libre/xtensa-unknown-elf-glibc/glibc-2.17-getaddrinfo-stack-overflow.patch
parentf23143833b78f880e6184c7f0eb25ba969b7945a (diff)
xtensa-unknown-elf-{binutils,gcc,glibc,linux-libre-api-headers}: adding and fixing cross pkg
Diffstat (limited to 'libre/xtensa-unknown-elf-glibc/glibc-2.17-getaddrinfo-stack-overflow.patch')
-rw-r--r--libre/xtensa-unknown-elf-glibc/glibc-2.17-getaddrinfo-stack-overflow.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/libre/xtensa-unknown-elf-glibc/glibc-2.17-getaddrinfo-stack-overflow.patch b/libre/xtensa-unknown-elf-glibc/glibc-2.17-getaddrinfo-stack-overflow.patch
new file mode 100644
index 000000000..aa916ac2c
--- /dev/null
+++ b/libre/xtensa-unknown-elf-glibc/glibc-2.17-getaddrinfo-stack-overflow.patch
@@ -0,0 +1,47 @@
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index d95c2d1..2309281 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -2489,11 +2489,27 @@ getaddrinfo (const char *name, const char *service,
+ __typeof (once) old_once = once;
+ __libc_once (once, gaiconf_init);
+ /* Sort results according to RFC 3484. */
+- struct sort_result results[nresults];
+- size_t order[nresults];
++ struct sort_result *results;
++ size_t *order;
+ struct addrinfo *q;
+ struct addrinfo *last = NULL;
+ char *canonname = NULL;
++ bool malloc_results;
++
++ malloc_results
++ = !__libc_use_alloca (nresults * (sizeof (*results) + sizeof (size_t)));
++ if (malloc_results)
++ {
++ results = malloc (nresults * (sizeof (*results) + sizeof (size_t)));
++ if (results == NULL)
++ {
++ __free_in6ai (in6ai);
++ return EAI_MEMORY;
++ }
++ }
++ else
++ results = alloca (nresults * (sizeof (*results) + sizeof (size_t)));
++ order = (size_t *) (results + nresults);
+
+ /* Now we definitely need the interface information. */
+ if (! check_pf_called)
+@@ -2664,6 +2680,9 @@ getaddrinfo (const char *name, const char *service,
+
+ /* Fill in the canonical name into the new first entry. */
+ p->ai_canonname = canonname;
++
++ if (malloc_results)
++ free (results);
+ }
+
+ __free_in6ai (in6ai);
+--
+1.7.1
+