]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
conncache: include the zone id in the "bundle" hashkey
authorDaniel Stenberg <daniel@haxx.se>
Mon, 25 Apr 2022 09:48:00 +0000 (11:48 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 25 Apr 2022 09:48:00 +0000 (11:48 +0200)
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

index ec669b971dc3408d19393bb5ee73c270afab380e..8948b53fa500c85090fd2952ce7a264025f4b798 100644 (file)
@@ -155,8 +155,12 @@ static void hashkey(struct connectdata *conn, char *buf,
     /* 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
   Curl_strntolower(buf, buf, len);
 }