From: Alex Rousskov Date: Tue, 31 Jan 2017 00:46:31 +0000 (-0700) Subject: Fix crash when configuring with invalid delay_parameters restore value. X-Git-Tag: M-staged-PR71~287 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c86f80900daf0fda98058337b9c0cf9acc766af6;p=thirdparty%2Fsquid.git Fix crash when configuring with invalid delay_parameters restore value. ... 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. --- diff --git a/src/DelaySpec.cc b/src/DelaySpec.cc index d69aec40ec..2b2433e014 100644 --- a/src/DelaySpec.cc +++ b/src/DelaySpec.cc @@ -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(); }