Blame SOURCES/0055-curl-7.29.0-CVE-2017-1000257.patch

c260e0
From f8b7620e0578ef44e8fd958d32f348b535d1ab77 Mon Sep 17 00:00:00 2001
c260e0
From: Daniel Stenberg <daniel@haxx.se>
c260e0
Date: Sat, 7 Oct 2017 00:11:31 +0200
c260e0
Subject: [PATCH] imap: if a FETCH response has no size, don't call write
c260e0
 callback
c260e0
c260e0
CVE-2017-1000257
c260e0
c260e0
Reported-by: Brian Carpenter and 0xd34db347
c260e0
Also detected by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3586
c260e0
c260e0
Upstream-commit: 13c9a9ded3ae744a1e11cbc14e9146d9fa427040
c260e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c260e0
---
c260e0
 lib/imap.c | 5 +++++
c260e0
 1 file changed, 5 insertions(+)
c260e0
c260e0
diff --git a/lib/imap.c b/lib/imap.c
c260e0
index 48af290..4deba88 100644
c260e0
--- a/lib/imap.c
c260e0
+++ b/lib/imap.c
c260e0
@@ -1137,6 +1137,11 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn, int imapcode,
c260e0
         /* the conversion from curl_off_t to size_t is always fine here */
c260e0
         chunk = (size_t)filesize;
c260e0
 
c260e0
+      if(!chunk) {
c260e0
+        /* no size, we're done with the data */
c260e0
+        state(conn, IMAP_STOP);
c260e0
+        return CURLE_OK;
c260e0
+      }
c260e0
       result = Curl_client_write(conn, CLIENTWRITE_BODY, pp->cache, chunk);
c260e0
       if(result)
c260e0
         return result;
c260e0
-- 
c260e0
2.13.6
c260e0