From: Tobias Blomberg Date: Thu, 26 Jul 2018 21:22:49 +0000 (+0200) Subject: curl: Fix segfault when -H @headerfile is empty X-Git-Tag: curl-7_61_1~117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e9b3a3798885b31fe316cafa57425f44bcd1a2c;p=thirdparty%2Fcurl.git 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 --- diff --git a/src/tool_getparam.c b/src/tool_getparam.c index cc3fcf3a57..e42a894cba 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -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");