summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2016-8619.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/curl/curl/CVE-2016-8619.patch')
-rw-r--r--meta/recipes-support/curl/curl/CVE-2016-8619.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2016-8619.patch b/meta/recipes-support/curl/curl/CVE-2016-8619.patch
new file mode 100644
index 0000000000..2c8f0599b2
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2016-8619.patch
@@ -0,0 +1,56 @@
1From 91239f7040b1f026d4d15765e7e3f58e92e93761 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Wed, 28 Sep 2016 12:56:02 +0200
4Subject: [PATCH] krb5: avoid realloc(0)
5
6If the requested size is zero, bail out with error instead of doing a
7realloc() that would cause a double-free: realloc(0) acts as a free()
8and then there's a second free in the cleanup path.
9
10CVE-2016-8619
11
12Bug: https://curl.haxx.se/docs/adv_20161102E.html
13Reported-by: Cure53
14
15Upstream-Status: Backport
16https://curl.haxx.se/CVE-2016-8619.patch
17CVE: CVE-2016-8619
18Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>
19
20---
21 lib/security.c | 9 ++++++---
22 1 file changed, 6 insertions(+), 3 deletions(-)
23
24diff --git a/lib/security.c b/lib/security.c
25index a268d4a..4cef8f8 100644
26--- a/lib/security.c
27+++ b/lib/security.c
28@@ -190,19 +190,22 @@ socket_write(struct connectdata *conn, curl_socket_t fd, const void *to,
29 static CURLcode read_data(struct connectdata *conn,
30 curl_socket_t fd,
31 struct krb5buffer *buf)
32 {
33 int len;
34- void* tmp;
35+ void *tmp = NULL;
36 CURLcode result;
37
38 result = socket_read(fd, &len, sizeof(len));
39 if(result)
40 return result;
41
42- len = ntohl(len);
43- tmp = realloc(buf->data, len);
44+ if(len) {
45+ /* only realloc if there was a length */
46+ len = ntohl(len);
47+ tmp = realloc(buf->data, len);
48+ }
49 if(tmp == NULL)
50 return CURLE_OUT_OF_MEMORY;
51
52 buf->data = tmp;
53 result = socket_read(fd, buf->data, len);
54--
552.9.3
56