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
This commit is contained in:
Daniel Stenberg
2025-09-19 17:36:29 +02:00
parent b0c823b86f
commit 58f071dbe4

View File

@@ -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)