From: Sona Sarmadi <sona.sarmadi@enea.com>
To: <openembedded-core@lists.openembedded.org>
Cc: sona@enea.se
Subject: [PATCH][krogoth 04/12] curl: CVE-2016-8618
Date: Fri, 11 Nov 2016 10:49:06 +0100 [thread overview]
Message-ID: <1478857754-61379-4-git-send-email-sona.sarmadi@enea.com> (raw)
In-Reply-To: <1478857754-61379-1-git-send-email-sona.sarmadi@enea.com>
double-free in curl_maprintf
Affected versions: curl 7.1 to and including 7.50.3
Reference:
https://curl.haxx.se/docs/adv_20161102D.html
Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
---
meta/recipes-support/curl/curl/CVE-2016-8618.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-8618.patch
diff --git a/meta/recipes-support/curl/curl/CVE-2016-8618.patch b/meta/recipes-support/curl/curl/CVE-2016-8618.patch
new file mode 100644
index 0000000..2fd4749
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2016-8618.patch
@@ -0,0 +1,52 @@
+From 31106a073882656a2a5ab56c4ce2847e9a334c3c Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Wed, 28 Sep 2016 10:15:34 +0200
+Subject: [PATCH] aprintf: detect wrap-around when growing allocation
+
+On 32bit systems we could otherwise wrap around after 2GB and allocate 0
+bytes and crash.
+
+CVE: CVE-2016-8618
+Upstream-Status: Backport
+
+Bug: https://curl.haxx.se/docs/adv_20161102D.html
+Reported-by: Cure53
+Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
+---
+ lib/mprintf.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/lib/mprintf.c b/lib/mprintf.c
+index dbedeaa..2c88aa8 100644
+--- a/lib/mprintf.c
++++ b/lib/mprintf.c
+@@ -1034,20 +1034,23 @@ static int alloc_addbyter(int output, FILE *data)
+ }
+ infop->alloc = 32;
+ infop->len =0;
+ }
+ else if(infop->len+1 >= infop->alloc) {
+- char *newptr;
++ char *newptr = NULL;
++ size_t newsize = infop->alloc*2;
+
+- newptr = realloc(infop->buffer, infop->alloc*2);
++ /* detect wrap-around or other overflow problems */
++ if(newsize > infop->alloc)
++ newptr = realloc(infop->buffer, newsize);
+
+ if(!newptr) {
+ infop->fail = 1;
+ return -1; /* fail */
+ }
+ infop->buffer = newptr;
+- infop->alloc *= 2;
++ infop->alloc = newsize;
+ }
+
+ infop->buffer[ infop->len ] = outc;
+
+ infop->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 3724411..27a999e 100644
--- a/meta/recipes-support/curl/curl_7.47.1.bb
+++ b/meta/recipes-support/curl/curl_7.47.1.bb
@@ -18,6 +18,7 @@ SRC_URI += " file://configure_ac.patch \
file://CVE-2016-8615.patch \
file://CVE-2016-8616.patch \
file://CVE-2016-8617.patch \
+ file://CVE-2016-8618.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 ` Sona Sarmadi [this message]
2016-11-11 9:49 ` [PATCH][krogoth 05/12] curl: CVE-2016-8619 Sona Sarmadi
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-4-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