]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib1560: verify that more bad host names are rejected
authorDaniel Stenberg <daniel@haxx.se>
Tue, 11 Apr 2023 07:15:41 +0000 (09:15 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 11 Apr 2023 09:33:07 +0000 (11:33 +0200)
when setting the hostname component of a URL

Closes #10922

tests/libtest/lib1560.c

index fe763b1ce55ba819e14ccd8c7a540948b403d76f..d9d9afb6ea33038e62ab117c8d2759b16c049090 100644 (file)
@@ -697,6 +697,24 @@ static int checkurl(const char *org, const char *url, const char *out)
 
 /* !checksrc! disable SPACEBEFORECOMMA 1 */
 static const struct setcase set_parts_list[] = {
+  {"https://example.com/",
+   "host=http://fake,",
+   "",
+   0, /* get */
+   0, /* set */
+   CURLUE_OK, CURLUE_BAD_HOSTNAME},
+  {"https://example.com/",
+   "host=test%,",
+   "",
+   0, /* get */
+   0, /* set */
+   CURLUE_OK, CURLUE_BAD_HOSTNAME},
+  {"https://example.com/",
+   "host=te st,",
+   "",
+   0, /* get */
+   0, /* set */
+   CURLUE_OK, CURLUE_BAD_HOSTNAME},
   {"https://example.com/",
    "host=0xff,", /* '++' there's no automatic URL decode when settin this
                   part */