blob: 3d086c4d9090f543b3357e6dff97c84cef720c39 [file] [log] [blame]
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