]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/DelaySpec.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / DelaySpec.cc
index e066a8e4818fee58a0aa7f2b4032e4bb593bc90e..7869cd024974e36f267317db9c6ae71bb6b0a641 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -43,8 +43,10 @@ DelaySpec::parse()
 {
     // get the token.
     char *token = ConfigParser::NextToken();
-    if (token == NULL)
+    if (!token) {
         self_destruct();
+        return;
+    }
 
     // no-limit value
     if (strcmp(token, "none") == 0 || token[0] == '-') {
@@ -55,7 +57,7 @@ DelaySpec::parse()
 
     // parse the first digits into restore_bps
     const char *p = NULL;
-    if (!StringToInt(token, restore_bps, &p, 10) && *p != '/') {
+    if (!StringToInt(token, restore_bps, &p, 10) || *p != '/') {
         debugs(77, DBG_CRITICAL, "ERROR: invalid delay rate '" << token << "'. Expecting restore/max or 'none'.");
         self_destruct();
     }