aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Blomberg <sm0svx@users.noreply.github.com>2018-07-26 23:22:49 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-07-28 22:48:31 +0200
commit3e9b3a3798885b31fe316cafa57425f44bcd1a2c (patch)
treea9b062addd66c64505ee6721f8da3f72e46cdbe1
parentd3905419444614463506243930be1648fb2d7aa7 (diff)
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
-rw-r--r--src/tool_getparam.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index cc3fcf3a5..e42a894cb 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");