]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_operate: avoid NULL dereference of first_arg
authorDaniel Stenberg <daniel@haxx.se>
Sat, 26 Dec 2020 15:20:54 +0000 (16:20 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 26 Dec 2020 22:46:14 +0000 (23:46 +0100)
Follow-up to 6a5e020d4d2b04a
Identified by OSS-Fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28999
Closes #6377

src/tool_operate.c

index 5635483d1b13829618adb6c019062f352b96e654..15e82b4bdeddfb57ac53df904bfe101ac30699e5 100644 (file)
@@ -2539,7 +2539,7 @@ CURLcode operate(struct GlobalConfig *global, int argc, argv_item_t argv[])
 
   /* Parse .curlrc if necessary */
   if((argc == 1) ||
-     (strncmp(first_arg, "-q", 2) &&
+     (first_arg && strncmp(first_arg, "-q", 2) &&
       !curl_strequal(first_arg, "--disable"))) {
     parseconfig(NULL, global); /* ignore possible failure */