mirror of
https://github.com/curl/curl.git
synced 2026-07-24 01:07:18 +03:00
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
This commit is contained in:
parent
1b71bc532b
commit
4c34af4c99
3 changed files with 51 additions and 3 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue