xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From f489d50ca5fd8b6a3a622e2521e2ca52787a6608 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 25 Apr 2022 16:24:33 +0200
4Subject: [PATCH] connect: store "conn_remote_port" in the info struct
5
6To make it available after the connection ended.
7
8Prerequisite for the patches that address CVE-2022-27774.
9
10Upstream-Status: Backport [https://github.com/curl/curl/commit/08b8ef4e726ba10f45081ecda5b3cea788d3c839]
11Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
12---
13 lib/connect.c | 1 +
14 lib/urldata.h | 6 +++++-
15 2 files changed, 6 insertions(+), 1 deletion(-)
16
17diff --git a/lib/connect.c b/lib/connect.c
18index 64f9511..7518807 100644
19--- a/lib/connect.c
20+++ b/lib/connect.c
21@@ -623,6 +623,7 @@ void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn,
22   data->info.conn_scheme = conn->handler->scheme;
23   data->info.conn_protocol = conn->handler->protocol;
24   data->info.conn_primary_port = conn->port;
25+  data->info.conn_remote_port = conn->remote_port;
26   data->info.conn_local_port = local_port;
27 }
28
29diff --git a/lib/urldata.h b/lib/urldata.h
30index f92052a..5218f76 100644
31--- a/lib/urldata.h
32+++ b/lib/urldata.h
33@@ -1160,7 +1160,11 @@ struct PureInfo {
34      reused, in the connection cache. */
35
36   char conn_primary_ip[MAX_IPADR_LEN];
37-  int conn_primary_port;
38+  int conn_primary_port; /* this is the destination port to the connection,
39+                            which might have been a proxy */
40+  int conn_remote_port;  /* this is the "remote port", which is the port
41+                            number of the used URL, independent of proxy or
42+                            not */
43   char conn_local_ip[MAX_IPADR_LEN];
44   int conn_local_port;
45   const char *conn_scheme;
46