summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-support/curl/curl/0001-url-free-old-conn-better-on-reuse.patch95
-rw-r--r--meta/recipes-support/curl/curl_7.82.0.bb1
2 files changed, 96 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/0001-url-free-old-conn-better-on-reuse.patch b/meta/recipes-support/curl/curl/0001-url-free-old-conn-better-on-reuse.patch
new file mode 100644
index 0000000000..520fd01b5e
--- /dev/null
+++ b/meta/recipes-support/curl/curl/0001-url-free-old-conn-better-on-reuse.patch
@@ -0,0 +1,95 @@
1From 06d12105c7aa883a62802e36eebb76d5303247d0 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Sat, 14 May 2022 18:04:46 +0200
4Subject: [PATCH] url: free old conn better on reuse
5
6Make use of conn_free() better and avoid duplicate code.
7
8Reported-by: Andrea Pappacoda
9Fixes #8841
10Closes #8842
11
12Upstream-Status: Backport [https://github.com/curl/curl/commit/06d12105c7aa883a62802e36eebb76d5303247d0]
13
14Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
15---
16 lib/url.c | 34 ++++------------------------------
17 1 file changed, 4 insertions(+), 30 deletions(-)
18
19diff --git a/lib/url.c b/lib/url.c
20index 631e49696..c2d9e78f4 100644
21--- a/lib/url.c
22+++ b/lib/url.c
23@@ -3498,17 +3498,6 @@ static void reuse_conn(struct Curl_easy *data,
24 **established** from the primary socket to a remote address. */
25 char local_ip[MAX_IPADR_LEN] = "";
26 int local_port = -1;
27-#ifndef CURL_DISABLE_PROXY
28- Curl_free_idnconverted_hostname(&old_conn->http_proxy.host);
29- Curl_free_idnconverted_hostname(&old_conn->socks_proxy.host);
30-
31- free(old_conn->http_proxy.host.rawalloc);
32- free(old_conn->socks_proxy.host.rawalloc);
33- Curl_free_primary_ssl_config(&old_conn->proxy_ssl_config);
34-#endif
35- /* free the SSL config struct from this connection struct as this was
36- allocated in vain and is targeted for destruction */
37- Curl_free_primary_ssl_config(&old_conn->ssl_config);
38
39 /* get the user+password information from the old_conn struct since it may
40 * be new for this request even when we re-use an existing connection */
41@@ -3539,20 +3528,17 @@ static void reuse_conn(struct Curl_easy *data,
42 old_conn->http_proxy.passwd = NULL;
43 old_conn->socks_proxy.passwd = NULL;
44 }
45- Curl_safefree(old_conn->http_proxy.user);
46- Curl_safefree(old_conn->socks_proxy.user);
47- Curl_safefree(old_conn->http_proxy.passwd);
48- Curl_safefree(old_conn->socks_proxy.passwd);
49 #endif
50
51- /* host can change, when doing keepalive with a proxy or if the case is
52- different this time etc */
53 Curl_free_idnconverted_hostname(&conn->host);
54 Curl_free_idnconverted_hostname(&conn->conn_to_host);
55 Curl_safefree(conn->host.rawalloc);
56 Curl_safefree(conn->conn_to_host.rawalloc);
57 conn->host = old_conn->host;
58+ old_conn->host.rawalloc = NULL;
59+ old_conn->host.encalloc = NULL;
60 conn->conn_to_host = old_conn->conn_to_host;
61+ old_conn->conn_to_host.rawalloc = NULL;
62 conn->conn_to_port = old_conn->conn_to_port;
63 conn->remote_port = old_conn->remote_port;
64 Curl_safefree(conn->hostname_resolve);
65@@ -3572,15 +3558,7 @@ static void reuse_conn(struct Curl_easy *data,
66 /* re-use init */
67 conn->bits.reuse = TRUE; /* yes, we're re-using here */
68
69- Curl_safefree(old_conn->user);
70- Curl_safefree(old_conn->passwd);
71- Curl_safefree(old_conn->options);
72- Curl_safefree(old_conn->localdev);
73- Curl_llist_destroy(&old_conn->easyq, NULL);
74-
75-#ifdef USE_UNIX_SOCKETS
76- Curl_safefree(old_conn->unix_domain_socket);
77-#endif
78+ conn_free(old_conn);
79 }
80
81 /**
82@@ -3930,10 +3908,6 @@ static CURLcode create_conn(struct Curl_easy *data,
83 * allocated before we can move along and use the previously existing one.
84 */
85 reuse_conn(data, conn, conn_temp);
86-#ifdef USE_SSL
87- free(conn->ssl_extra);
88-#endif
89- free(conn); /* we don't need this anymore */
90 conn = conn_temp;
91 *in_connect = conn;
92
93--
942.34.1
95
diff --git a/meta/recipes-support/curl/curl_7.82.0.bb b/meta/recipes-support/curl/curl_7.82.0.bb
index a613e93780..ba3abadac9 100644
--- a/meta/recipes-support/curl/curl_7.82.0.bb
+++ b/meta/recipes-support/curl/curl_7.82.0.bb
@@ -61,6 +61,7 @@ SRC_URI = "https://curl.se/download/${BP}.tar.xz \
61 file://CVE-2024-7264_1.patch \ 61 file://CVE-2024-7264_1.patch \
62 file://CVE-2024-7264_2.patch \ 62 file://CVE-2024-7264_2.patch \
63 file://CVE-2024-8096.patch \ 63 file://CVE-2024-8096.patch \
64 file://0001-url-free-old-conn-better-on-reuse.patch \
64 " 65 "
65SRC_URI[sha256sum] = "0aaa12d7bd04b0966254f2703ce80dd5c38dbbd76af0297d3d690cdce58a583c" 66SRC_URI[sha256sum] = "0aaa12d7bd04b0966254f2703ce80dd5c38dbbd76af0297d3d690cdce58a583c"
66 67