summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch
blob: 063c11712abb05e5cde3a7c6752e8df1d65efd5b (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
44
45
From 2a797e099731facf62a2c675396334bc2ad3bc7c Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 25 Apr 2022 16:24:33 +0200
Subject: [PATCH] connect: store "conn_remote_port" in the info struct

To make it available after the connection ended.

Prerequisite for the patches that address CVE-2022-27774.

Upstream-Status: Backport [https://github.com/curl/curl/commit/08b8ef4e726ba10f45081ecda5b3cea788d3c839]
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
---
 lib/connect.c | 1 +
 lib/urldata.h | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/connect.c b/lib/connect.c
index b3d4057..a977d67 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -624,6 +624,7 @@ void Curl_persistconninfo(struct connectdata *conn)
   conn->data->info.conn_scheme = conn->handler->scheme;
   conn->data->info.conn_protocol = conn->handler->protocol;
   conn->data->info.conn_primary_port = conn->primary_port;
+  conn->data->info.conn_remote_port = conn->remote_port;
   conn->data->info.conn_local_port = conn->local_port;
 }
 
diff --git a/lib/urldata.h b/lib/urldata.h
index fafb7a3..ab1b267 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1148,7 +1148,11 @@ struct PureInfo {
      reused, in the connection cache. */
 
   char conn_primary_ip[MAX_IPADR_LEN];
-  long conn_primary_port;
+  long conn_primary_port; /* this is the destination port to the connection,
+                             which might have been a proxy */
+  long conn_remote_port;  /* this is the "remote port", which is the port
+                             number of the used URL, independent of proxy or
+                             not */
   char conn_local_ip[MAX_IPADR_LEN];
   long conn_local_port;
   const char *conn_scheme;