From 6596970bd2626f94ddd9a08a1d3a00b08394e860 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Mon, 6 Feb 2017 09:56:55 +1300 Subject: [PATCH] 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. --- src/DelaySpec.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); } -- 2.47.3