]> 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>
Sun, 26 Feb 2017 08:52:45 +0000 (21:52 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 26 Feb 2017 08:52:45 +0000 (21:52 +1300)
 Detected by Coverity Scan. Issue 1364726.

src/main.cc

index 2a7e7f3cba0cc9c5ff06b5a77712ef296d1430c3..e4d879c207f6490453542eb6f3e349cbbc0ec45e 100644 (file)
@@ -425,11 +425,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)))