]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_urlglob: support globs as long as config line lengths
authorDaniel Stenberg <daniel@haxx.se>
Sat, 13 Dec 2025 12:48:59 +0000 (13:48 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 13 Dec 2025 13:26:20 +0000 (14:26 +0100)
libcurl supports up to 8MB string inputs, the config file accepts up to
10MB line lengths. It did not make sense to limit the globs to a maximum
of one megabyte.

Closes #19960

src/tool_cfgable.h
src/tool_parsecfg.c
src/tool_urlglob.c

index d02635ce244efc9e93d7b57d28dc0243c8e5eb56..ae6092076cd123513ad5a3516e4238ec35ff13db 100644 (file)
@@ -38,6 +38,8 @@
 #endif
 #endif
 
+#define MAX_CONFIG_LINE_LENGTH (10*1024*1024)
+
 #define checkprefix(a, b) curl_strnequal(b, STRCONST(a))
 
 #define tool_safefree(ptr) \
index fd669f96cf9a8b6aac54dedfb69db173faf1402a..ae206f8d5179eca8eaa123ab4f6b7741aee654d1 100644 (file)
@@ -77,8 +77,6 @@ static int unslashquote(const char *line, struct dynbuf *param)
   return 0; /* ok */
 }
 
-#define MAX_CONFIG_LINE_LENGTH (10*1024*1024)
-
 /* return 0 on everything-is-fine, and non-zero otherwise */
 ParameterError parseconfig(const char *filename, int max_recursive,
                            char **resolved)
index ad2e2de9d66b9f91de9737aef586b285eeb7897e..da073d03936162a1294d6f2a7f2839d716176c63 100644 (file)
@@ -500,7 +500,7 @@ CURLcode glob_url(struct URLGlob *glob, char *url, curl_off_t *urlnum,
   CURLcode res;
 
   memset(glob, 0, sizeof(struct URLGlob));
-  curlx_dyn_init(&glob->buf, 1024 * 1024);
+  curlx_dyn_init(&glob->buf, MAX_CONFIG_LINE_LENGTH);
   glob->pattern = curlx_malloc(2 * sizeof(struct URLPattern));
   if(!glob->pattern)
     return CURLE_OUT_OF_MEMORY;