]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix crash when configuring with invalid delay_parameters restore value.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 31 Jan 2017 00:46:31 +0000 (17:46 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 31 Jan 2017 00:46:31 +0000 (17:46 -0700)
... like none/none. Introduced in r13701 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 d69aec40ecb2a10e0f09e0592eca0e7f9a5d5b29..2b2433e014e0f50db84d275bafbea2f4816051af 100644 (file)
@@ -57,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();
     }