From 3e9b3a3798885b31fe316cafa57425f44bcd1a2c Mon Sep 17 00:00:00 2001 From: Tobias Blomberg Date: Thu, 26 Jul 2018 23:22:49 +0200 Subject: [PATCH] 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 --- src/tool_getparam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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");