curl/backport-Curl_connect_done-handle-being-called-twice.patch
sherlock2010 b8013d9c5e fix double-free when using https with tunneling proxy
(cherry picked from commit 1c3bb7fcab1c32af49a31d1bba5dfd417a7208d3)
2023-07-05 10:52:40 +08:00

39 lines
1.1 KiB
Diff

From b89a4b5191e8471acca14d7de904213b0aa20125 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Fri, 12 Nov 2021 13:34:49 +0100
Subject: [PATCH 1/1] Curl_connect_done: handle being called twice
Follow-up to f0b7099a10d1a7c
When torture testing 1021, it turns out the Curl_connect_done function
might be called twice and that previously then wrongly cleared the HTTP
pointer in the second invoke.
Closes #7999
Conflict:context adapt
Reference:https://github.com/curl/curl/commit/b89a4b5191e8471acca14d7de904213b0aa20125
---
lib/http_proxy.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index cfe616fa6..2555b401a 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -207,8 +207,9 @@ void Curl_connect_done(struct Curl_easy *data)
Curl_dyn_free(&s->rcvbuf);
Curl_dyn_free(&s->req);
- /* retore the protocol pointer */
- data->req.p.http = s->prot_save;
+ /* restore the protocol pointer, if not already done */
+ if(s->prot_save)
+ data->req.p.http = s->prot_save;
s->prot_save = NULL;
infof(data, "CONNECT phase completed!");
}
--
2.33.0