]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_paramhlp: bump maximum post data size in memory to 16GB
authorDaniel Stenberg <daniel@haxx.se>
Tue, 13 Aug 2024 07:12:18 +0000 (09:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 14 Aug 2024 05:57:24 +0000 (07:57 +0200)
- stick to 2GB for 32bit systems.

Reported-by: Tim Yuer
Fixes #14521
Closes #14523

src/tool_paramhlp.c
src/tool_paramhlp.h

index 82c0041d4a1487e2d3783e47b1cf7da26fb753cd..84b150cc429042bebabe6df3018b8aba9c4f98c0 100644 (file)
@@ -90,12 +90,11 @@ static size_t memcrlf(char *orig,
   return total; /* no delimiter found */
 }
 
-#define MAX_FILE2STRING (256*1024*1024) /* big enough ? */
+#define MAX_FILE2STRING MAX_FILE2MEMORY
 
 ParameterError file2string(char **bufp, FILE *file)
 {
   struct curlx_dynbuf dyn;
-  DEBUGASSERT(MAX_FILE2STRING < INT_MAX); /* needs to fit in an int later */
   curlx_dyn_init(&dyn, MAX_FILE2STRING);
   if(file) {
     do {
@@ -133,7 +132,6 @@ ParameterError file2memory(char **bufp, size_t *size, FILE *file)
     size_t nread;
     struct curlx_dynbuf dyn;
     /* The size needs to fit in an int later */
-    DEBUGASSERT(MAX_FILE2MEMORY < INT_MAX);
     curlx_dyn_init(&dyn, MAX_FILE2MEMORY);
     do {
       char buffer[4096];
index 96c49ac59e8bbe801852e60d40947df04890428d..bd703afc8ca759936c95dd12b635e1928cb59609 100644 (file)
@@ -30,7 +30,11 @@ struct getout *new_getout(struct OperationConfig *config);
 
 ParameterError file2string(char **bufp, FILE *file);
 
-#define MAX_FILE2MEMORY (1024*1024*1024) /* big enough ? */
+#if SIZEOF_SIZE_T > 4
+#define MAX_FILE2MEMORY (16LL*1024*1024*1024)
+#else
+#define MAX_FILE2MEMORY (INT_MAX)
+#endif
 
 ParameterError file2memory(char **bufp, size_t *size, FILE *file);