From 58f071dbe4be8dfc95dad4ac4c9574502966d1dd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 19 Sep 2025 17:36:29 +0200 Subject: [PATCH] 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 --- src/tool_getparam.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) -- 2.47.3