]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
url: output the maximum when rejecting a url
authorEmil Engler <me@emilengler.com>
Wed, 17 Aug 2022 07:57:44 +0000 (09:57 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 22 Aug 2022 21:36:02 +0000 (23:36 +0200)
This commit changes the failf message to output the maximum length, when
curl refuses to process a URL because it is too long.

See: #9317
Closes: #9327
lib/url.c

index 44c1d3f375e57f4a1e912bf45de10ad04fafe46d..54e4d04e53123f245c3a7c7345366b3a11c2b16a 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -154,6 +154,9 @@ static void conn_free(struct connectdata *conn);
 #define UNIX_SOCKET_PREFIX "localhost"
 #endif
 
+/* Reject URLs exceeding this length */
+#define MAX_URL_LEN 0xffff
+
 /*
 * get_protocol_family()
 *
@@ -2026,8 +2029,8 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
     if(!strcasecompare("file", data->state.up.scheme))
       return CURLE_OUT_OF_MEMORY;
   }
-  else if(strlen(data->state.up.hostname) > 0xffff) {
-    failf(data, "Too long host name");
+  else if(strlen(data->state.up.hostname) > MAX_URL_LEN) {
+    failf(data, "Too long host name (maximum is %d)", MAX_URL_LEN);
     return CURLE_URL_MALFORMAT;
   }