From: Daniel Stenberg Date: Fri, 19 Sep 2025 15:36:29 +0000 (+0200) Subject: tool_getparam/set_rate: skip the multiplication on overflow X-Git-Tag: rc-8_17_0-3~545 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58f071dbe4be8dfc95dad4ac4c9574502966d1dd;p=thirdparty%2Fcurl.git tool_getparam/set_rate: skip the multiplication on overflow The code detected the problem but didn't avoid the calculation correctly. Fixes #18624 Reported-by: BobodevMm on github Closes #18625 --- diff --git a/src/tool_getparam.c b/src/tool_getparam.c index f2ad6daf2e..b8fec5f7ab 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -1012,8 +1012,9 @@ static ParameterError set_rate(const char *nextarg) errorf("too large --rate unit"); err = PARAM_NUMBER_TOO_LARGE; } - /* this typecast is okay based on the check above */ - numerator *= (long)numunits; + else + /* this typecast is okay based on the check above */ + numerator *= (long)numunits; } if(err)