]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix crash when configuring with invalid delay_parameters restore value.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 26 Feb 2017 08:46:24 +0000 (21:46 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 26 Feb 2017 08:46:24 +0000 (21:46 +1300)
... like none/none. Introduced in rev which fixed another, much
bigger delay_parameters parsing bug.

TODO: Reject all invalid input, including restore/max of "-/100".

TODO: Fix misleading/wrong associated error messages. For example:
  ERROR: invalid delay rate 'none/none'. Expecting restore/max or 'none'
  ERROR: restore rate in '1/none' is not a number.

src/DelaySpec.cc

index 9cc8dc42bef0d1efd207be5a7ec69dca70a4ee8c..613d5136f90861606118c9cdb765bead092e8eb6 100644 (file)
@@ -55,7 +55,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();
     }