From ad6320b8a577f2c5401d85976b168ab873ff3fdc Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 13 Aug 2024 09:12:18 +0200 Subject: [PATCH] tool_paramhlp: bump maximum post data size in memory to 16GB - stick to 2GB for 32bit systems. Reported-by: Tim Yuer Fixes #14521 Closes #14523 --- src/tool_paramhlp.c | 4 +--- src/tool_paramhlp.h | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 82c0041d4a..84b150cc42 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -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]; diff --git a/src/tool_paramhlp.h b/src/tool_paramhlp.h index 96c49ac59e..bd703afc8c 100644 --- a/src/tool_paramhlp.h +++ b/src/tool_paramhlp.h @@ -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); -- 2.47.3