From: Sona Sarmadi <sona.sarmadi@enea.com>
To: <openembedded-core@lists.openembedded.org>
Cc: sona@enea.se
Subject: [PATCH][krogoth 05/12] curl: CVE-2016-8619
Date: Fri, 11 Nov 2016 10:49:07 +0100 [thread overview]
Message-ID: <1478857754-61379-5-git-send-email-sona.sarmadi@enea.com> (raw)
In-Reply-To: <1478857754-61379-1-git-send-email-sona.sarmadi@enea.com>
double-free in krb5 code
Affected versions: curl 7.3 to and including 7.50.3
Reference:
https://curl.haxx.se/docs/adv_20161102E.html
Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
---
meta/recipes-support/curl/curl/CVE-2016-8619.patch | 52 ++++++++++++++++++++++
meta/recipes-support/curl/curl_7.47.1.bb | 1 +
2 files changed, 53 insertions(+)
create mode 100644 meta/recipes-support/curl/curl/CVE-2016-8619.patch
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 0000000..fb21cf6
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2016-8619.patch
@@ -0,0 +1,52 @@
+From 91239f7040b1f026d4d15765e7e3f58e92e93761 Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Wed, 28 Sep 2016 12:56:02 +0200
+Subject: [PATCH] krb5: avoid realloc(0)
+
+If the requested size is zero, bail out with error instead of doing a
+realloc() that would cause a double-free: realloc(0) acts as a free()
+and then there's a second free in the cleanup path.
+
+CVE: CVE-2016-8619
+Upstream-Status: Backport
+
+Bug: https://curl.haxx.se/docs/adv_20161102E.html
+Reported-by: Cure53
+Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
+---
+ lib/security.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/lib/security.c b/lib/security.c
+index a268d4a..4cef8f8 100644
+--- a/lib/security.c
++++ b/lib/security.c
+@@ -190,19 +190,22 @@ socket_write(struct connectdata *conn, curl_socket_t fd, const void *to,
+ static CURLcode read_data(struct connectdata *conn,
+ curl_socket_t fd,
+ struct krb5buffer *buf)
+ {
+ int len;
+- void* tmp;
++ void *tmp = NULL;
+ CURLcode result;
+
+ result = socket_read(fd, &len, sizeof(len));
+ if(result)
+ return result;
+
+- len = ntohl(len);
+- tmp = realloc(buf->data, len);
++ if(len) {
++ /* only realloc if there was a length */
++ len = ntohl(len);
++ tmp = realloc(buf->data, len);
++ }
+ if(tmp == NULL)
+ return CURLE_OUT_OF_MEMORY;
+
+ buf->data = tmp;
+ result = socket_read(fd, buf->data, len);
+--
+2.9.3
+
diff --git a/meta/recipes-support/curl/curl_7.47.1.bb b/meta/recipes-support/curl/curl_7.47.1.bb
index 27a999e..9ef5718 100644
--- a/meta/recipes-support/curl/curl_7.47.1.bb
+++ b/meta/recipes-support/curl/curl_7.47.1.bb
@@ -19,6 +19,7 @@ SRC_URI += " file://configure_ac.patch \
file://CVE-2016-8616.patch \
file://CVE-2016-8617.patch \
file://CVE-2016-8618.patch \
+ file://CVE-2016-8619.patch \
"
SRC_URI[md5sum] = "9ea3123449439bbd960cd25cf98796fb"
--
1.9.1
next prev parent reply other threads:[~2016-11-11 9:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-11 9:49 [PATCH][krogoth 01/12] curl: CVE-2016-8615 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 02/12] curl: CVE-2016-8616 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 03/12] curl: CVE-2016-8617 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 04/12] curl: CVE-2016-8618 Sona Sarmadi
2016-11-11 9:49 ` Sona Sarmadi [this message]
2016-11-11 9:49 ` [PATCH][krogoth 06/12] curl: CVE-2016-8620 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 07/12] curl: CVE-2016-8621 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 08/12] curl: CVE-2016-8622 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 09/12] curl: CVE-2016-8623 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 10/12] curl: CVE-2016-8624 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 11/12] curl: CVE-2016-8625 Sona Sarmadi
2016-11-11 9:49 ` [PATCH][krogoth 12/12] curl/url: remove unconditional idn2.h include Sona Sarmadi
2016-11-11 10:53 ` Anders Darander
2016-11-11 11:07 ` Burton, Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1478857754-61379-5-git-send-email-sona.sarmadi@enea.com \
--to=sona.sarmadi@enea.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=sona@enea.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox