From: Alex Rousskov Date: Sun, 26 Feb 2017 08:46:24 +0000 (+1300) Subject: Fix crash when configuring with invalid delay_parameters restore value. X-Git-Tag: SQUID_3_5_25~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7547051d5bb89e9bee52062fcd29d1e1ada3dfab;p=thirdparty%2Fsquid.git Fix crash when configuring with invalid delay_parameters restore value. ... 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. --- diff --git a/src/DelaySpec.cc b/src/DelaySpec.cc index 9cc8dc42be..613d5136f9 100644 --- a/src/DelaySpec.cc +++ b/src/DelaySpec.cc @@ -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(); }