1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

curl: Fix segfault when -H @headerfile is empty

The curl binary would crash if the -H command line option was given a
filename to read using the @filename syntax but that file was empty.

Closes #2797
This commit is contained in:
Tobias Blomberg 2018-07-26 23:22:49 +02:00 committed by Daniel Stenberg
parent d390541944
commit 3e9b3a3798
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1706,7 +1706,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
warnf(global, "Failed to open %s!\n", &nextarg[1]);
else {
err = file2memory(&string, &len, file);
if(!err) {
if(!err && string) {
/* Allow strtok() here since this isn't used threaded */
/* !checksrc! disable BANNEDFUNC 2 */
char *h = strtok(string, "\r\n");