• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 058f98dc3fe595f21dc26a5b9b1699e519ba5705 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 25 Apr 2022 11:48:00 +0200
4Subject: [PATCH] conncache: include the zone id in the "bundle" hashkey
5
6Make connections to two separate IPv6 zone ids create separate
7connections.
8
9Reported-by: Harry Sintonen
10Bug: https://curl.se/docs/CVE-2022-27775.html
11Closes #8747
12---
13 lib/conncache.c | 8 ++++++--
14 1 file changed, 6 insertions(+), 2 deletions(-)
15
16diff --git a/lib/conncache.c b/lib/conncache.c
17index ec669b971dc3..8948b53fa500 100644
18--- a/lib/conncache.c
19+++ b/lib/conncache.c
20@@ -155,8 +155,12 @@ static void hashkey(struct connectdata *conn, char *buf,
21     /* report back which name we used */
22     *hostp = hostname;
23
24-  /* put the number first so that the hostname gets cut off if too long */
25-  msnprintf(buf, len, "%ld%s", port, hostname);
26+  /* put the numbers first so that the hostname gets cut off if too long */
27+#ifdef ENABLE_IPV6
28+  msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
29+#else
30+  msnprintf(buf, len, "%ld/%s", port, hostname);
31+#endif
32   Curl_strntolower(buf, buf, len);
33 }
34
35