]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urlapi: forbid '|' in host
authortiymat <138939221+tiymat@users.noreply.github.com>
Wed, 27 May 2026 01:05:27 +0000 (22:35 -0230)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 27 May 2026 07:39:37 +0000 (09:39 +0200)
Closes #21762

lib/urlapi.c
tests/libtest/lib1560.c

index ef5b2b48e9092f808224ed7198cfdd33a90cac91..589a400834b1ef31fba2bc714fe0957638c3ee5a 100644 (file)
@@ -471,7 +471,7 @@ static CURLUcode hostname_check(struct Curl_URL *u, char *hostname,
     return ipv6_parse(u, hostname, hlen);
   else {
     /* letters from the second string are not ok */
-    len = strcspn(hostname, " \r\n\t/:#?!@{}[]\\$\'\"^`*<>=;,+&()%");
+    len = strcspn(hostname, " \r\n\t/:#?!@{}[]\\$\'\"^`*<>=;,+&()%|");
     if(hlen != len)
       /* hostname with bad content */
       return CURLUE_BAD_HOSTNAME;
index 3eeed6b6943d7004375416d25c964291d0640b2a..69c7fd857b922379f7549e87e741bccb5767d7fb 100644 (file)
@@ -326,6 +326,7 @@ static const struct testcase get_parts_list[] = {
   {"https://user@example.net?he l lo",
    "https | user | [12] | [13] | example.net | [15] | / | he l lo | [17]",
    CURLU_ALLOW_SPACE, 0, CURLUE_OK},
+  {"https://exam|ple.net", "", 0, 0, CURLUE_BAD_HOSTNAME},
   {"https://exam{}[]ple.net", "", 0, 0, CURLUE_BAD_HOSTNAME},
   {"https://exam{ple.net", "", 0, 0, CURLUE_BAD_HOSTNAME},
   {"https://exam}ple.net", "", 0, 0, CURLUE_BAD_HOSTNAME},