]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Check that -k argument is provided before trying to use it.
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 20 Feb 2017 05:04:45 +0000 (18:04 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 20 Feb 2017 05:04:45 +0000 (18:04 +1300)
 Detected by Coverity Scan. Issue 1364726.

src/main.cc

index 9333c0a8dc4c4b86ae9133d6982f418c4c20607a..6895d1422558f21b19e61749b5c4f6f1c8244b02 100644 (file)
@@ -523,11 +523,11 @@ mainParseOptions(int argc, char *argv[])
             /** \par k
              * Run the administrative action given following the option */
 
-            /** \li When its an unknown option display the usage help. */
-            if ((int) strlen(optarg) < 1)
+            /** \li When it is missing or an unknown option display the usage help. */
+            if (!optarg || strlen(optarg) < 1)
                 usage();
 
-            if (!strncmp(optarg, "reconfigure", strlen(optarg)))
+            else if (!strncmp(optarg, "reconfigure", strlen(optarg)))
                 /** \li On reconfigure send SIGHUP. */
                 opt_send_signal = SIGHUP;
             else if (!strncmp(optarg, "rotate", strlen(optarg)))