summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/curl/curl/CVE-2022-27775.patch
blob: b3fe7b44942da39c6d65eda198c491517825d466 (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
From 058f98dc3fe595f21dc26a5b9b1699e519ba5705 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 25 Apr 2022 11:48:00 +0200
Subject: [PATCH] conncache: include the zone id in the "bundle" hashkey

Make connections to two separate IPv6 zone ids create separate
connections.

Reported-by: Harry Sintonen
Bug: https://curl.se/docs/CVE-2022-27775.html
Closes #8747
---
 lib/conncache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

CVE: CVE-2022-27775
Upstream-Status: Backport [https://github.com/curl/curl/commit/058f98dc3fe595f21dc26a5b9b1699e519ba5705.patch]
Comment: Refreshed patch
Signed-off-by: Sana.Kazi <Sana.Kazi@kpit.com>

diff --git a/lib/conncache.c b/lib/conncache.c
index ec669b971dc3..8948b53fa500 100644
--- a/lib/conncache.c
+++ b/lib/conncache.c
@@ -156,8 +156,12 @@
     /* report back which name we used */
     *hostp = hostname;
 
-  /* put the number first so that the hostname gets cut off if too long */
-  msnprintf(buf, len, "%ld%s", port, hostname);
+  /* put the numbers first so that the hostname gets cut off if too long */
+#ifdef ENABLE_IPV6
+  msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
+#else
+  msnprintf(buf, len, "%ld/%s", port, hostname);
+#endif
 }
 
 /* Returns number of connections currently held in the connection cache.