aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-01-04 11:41:35 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-01-06 10:10:48 +0100
commit4c34af4c99d4e7385e341f5fe65cb42549ada152 (patch)
treeb6b4dfd8ef271909ac0a3eb095075c8663722f0b /src
parent1b71bc532bde8621fd3260843f8197182a467ff2 (diff)
curl -w: handle a blank input file correctly
Previously it would end up with an uninitialized memory buffer that would lead to a crash or junk getting output. Added test 1271 to verify. Reported-by: Brian Carpenter Closes #4786
Diffstat (limited to 'src')
-rw-r--r--src/tool_paramhlp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index de1b26d70..67702ebe2 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -65,7 +65,7 @@ ParameterError file2string(char **bufp, FILE *file)
size_t alloc_needed;
char buffer[256];
size_t stringlen = 0;
- string = malloc(alloc);
+ string = calloc(1, alloc);
if(!string)
return PARAM_NO_MEM;