Blame SOURCES/0064-curl-7.29.0-CVE-2018-1000301.patch

f0f8d7
From 5815730864a2010872840bae24797983e892eb90 Mon Sep 17 00:00:00 2001
f0f8d7
From: Daniel Stenberg <daniel@haxx.se>
f0f8d7
Date: Sat, 24 Mar 2018 23:47:41 +0100
b7b705
Subject: [PATCH] http: restore buffer pointer when bad response-line is parsed
f0f8d7
f0f8d7
... leaving the k->str could lead to buffer over-reads later on.
f0f8d7
f0f8d7
CVE: CVE-2018-1000301
f0f8d7
Assisted-by: Max Dymond
f0f8d7
f0f8d7
Detected by OSS-Fuzz.
f0f8d7
Bug: https://curl.haxx.se/docs/adv_2018-b138.html
f0f8d7
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7105
f0f8d7
f0f8d7
Upstream-commit: 8c7b3737d29ed5c0575bf592063de8a51450812d
f0f8d7
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
f0f8d7
---
f0f8d7
 lib/http.c | 6 +++++-
f0f8d7
 1 file changed, 5 insertions(+), 1 deletion(-)
f0f8d7
f0f8d7
diff --git a/lib/http.c b/lib/http.c
f0f8d7
index 841f6cc..dc10f5f 100644
f0f8d7
--- a/lib/http.c
f0f8d7
+++ b/lib/http.c
b7b705
@@ -2791,6 +2791,8 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
f0f8d7
 {
f0f8d7
   CURLcode result;
f0f8d7
   struct SingleRequest *k = &data->req;
f0f8d7
+  ssize_t onread = *nread;
f0f8d7
+  char *ostr = k->str;
f0f8d7
 
f0f8d7
   /* header line within buffer loop */
f0f8d7
   do {
b7b705
@@ -2855,7 +2857,9 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
f0f8d7
         else {
f0f8d7
           /* this was all we read so it's all a bad header */
f0f8d7
           k->badheader = HEADER_ALLBAD;
f0f8d7
-          *nread = (ssize_t)rest_length;
f0f8d7
+          *nread = onread;
f0f8d7
+          k->str = ostr;
f0f8d7
+          return CURLE_OK;
f0f8d7
         }
f0f8d7
         break;
f0f8d7
       }
f0f8d7
-- 
f0f8d7
2.14.3
f0f8d7