aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2018-16840.patch
blob: 3d086c4d9090f543b3357e6dff97c84cef720c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 3c2846bec008e03d456e181d9ab55686da83f140 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Thu, 1 Nov 2018 15:33:35 +0800
Subject: [PATCH] Curl_close: clear data->multi_easy on free to avoid
 use-after-free

Regression from b46cfbc (7.59.0)
CVE-2018-16840
Reported-by: Brian Carpenter (Geeknik Labs)

Bug: https://curl.haxx.se/docs/CVE-2018-16840.html

Upstream-Status: Backport [https://github.com/curl/curl/commit/
81d135d67155c5295b1033679c606165d4e28f3f]

CVE: CVE-2018-16840

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 lib/url.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/url.c b/lib/url.c
index 27b2c1e..7ef7c20 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -320,10 +320,12 @@ CURLcode Curl_close(struct Curl_easy *data)
        and detach this handle from there. */
     curl_multi_remove_handle(data->multi, data);
 
-  if(data->multi_easy)
+  if(data->multi_easy) {
     /* when curl_easy_perform() is used, it creates its own multi handle to
        use and this is the one */
     curl_multi_cleanup(data->multi_easy);
+    data->multi_easy = NULL;
+  }
 
   /* Destroy the timeout list that is held in the easy handle. It is
      /normally/ done by curl_multi_remove_handle() but this is "just in
-- 
2.7.4