summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc/CVE-2016-4429.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/glibc/glibc/CVE-2016-4429.patch')
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2016-4429.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/CVE-2016-4429.patch b/meta/recipes-core/glibc/glibc/CVE-2016-4429.patch
new file mode 100644
index 0000000000..24aa9a41a1
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/CVE-2016-4429.patch
@@ -0,0 +1,89 @@
1From bc779a1a5b3035133024b21e2f339fe4219fb11c Mon Sep 17 00:00:00 2001
2From: Florian Weimer <fweimer@redhat.com>
3Date: Mon, 23 May 2016 20:18:34 +0200
4Subject: [PATCH] CVE-2016-4429: sunrpc: Do not use alloca in clntudp_call [BZ
5 #20112]
6
7The call is technically in a loop, and under certain circumstances
8(which are quite difficult to reproduce in a test case), alloca
9can be invoked repeatedly during a single call to clntudp_call.
10As a result, the available stack space can be exhausted (even
11though individual alloca sizes are bounded implicitly by what
12can fit into a UDP packet, as a side effect of the earlier
13successful send operation).
14
15Upstream-Status: Backport
16CVE: CVE-2016-4429
17Signed-off-by: Armin Kuster <akuster@mvista.com>
18
19---
20 ChangeLog | 7 +++++++
21 NEWS | 4 ++++
22 sunrpc/clnt_udp.c | 10 +++++++++-
23 3 files changed, 20 insertions(+), 1 deletion(-)
24
25Index: git/ChangeLog
26===================================================================
27--- git.orig/ChangeLog
28+++ git/ChangeLog
29@@ -1,3 +1,10 @@
30+2016-05-23 Florian Weimer <fweimer@redhat.com>
31+
32+ CVE-2016-4429
33+ [BZ #20112]
34+ * sunrpc/clnt_udp.c (clntudp_call): Use malloc/free for the error
35+ payload.
36+
37 2016-04-29 Florian Weimer <fweimer@redhat.com>
38
39 [BZ #20010]
40Index: git/NEWS
41===================================================================
42--- git.orig/NEWS
43+++ git/NEWS
44@@ -5,6 +5,11 @@ See the end for copying conditions.
45 Security related changes:
46
47 [Add security related changes here]
48+
49+* The Sun RPC UDP client could exhaust all available stack space when
50+ flooded with crafted ICMP and UDP messages. Reported by Aldy Hernandez'
51+ alloca plugin for GCC. (CVE-2016-4429)
52+
53 * Previously, getaddrinfo copied large amounts of address data to the stack,
54 even after the fix for CVE-2013-4458 has been applied, potentially
55 resulting in a stack overflow. getaddrinfo now uses a heap allocation
56Index: git/sunrpc/clnt_udp.c
57===================================================================
58--- git.orig/sunrpc/clnt_udp.c
59+++ git/sunrpc/clnt_udp.c
60@@ -420,9 +420,15 @@ send_again:
61 struct sock_extended_err *e;
62 struct sockaddr_in err_addr;
63 struct iovec iov;
64- char *cbuf = (char *) alloca (outlen + 256);
65+ char *cbuf = malloc (outlen + 256);
66 int ret;
67
68+ if (cbuf == NULL)
69+ {
70+ cu->cu_error.re_errno = errno;
71+ return (cu->cu_error.re_status = RPC_CANTRECV);
72+ }
73+
74 iov.iov_base = cbuf + 256;
75 iov.iov_len = outlen;
76 msg.msg_name = (void *) &err_addr;
77@@ -447,10 +453,12 @@ send_again:
78 cmsg = CMSG_NXTHDR (&msg, cmsg))
79 if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR)
80 {
81+ free (cbuf);
82 e = (struct sock_extended_err *) CMSG_DATA(cmsg);
83 cu->cu_error.re_errno = e->ee_errno;
84 return (cu->cu_error.re_status = RPC_CANTRECV);
85 }
86+ free (cbuf);
87 }
88 #endif
89 do