mirror of
https://github.com/curl/curl.git
synced 2025-04-18 16:30:45 +08:00
tool_getparam: limit --rate to be smaller than number of ms
Currently, curl allows users to specify absurd request rates that might be higher than the number of milliseconds in the unit (ex: curl --rate 3600050/h http://localhost:8080 does not error out despite there being only 3600000ms in a hour). This change adds a conditional check before the millisecond calculation making sure that the number is not higher than the numerator (the unit) If the number is higher, curl errors out with PARAM_NUMBER_TOO_LARGE Closes #12116
This commit is contained in:
parent
e2006b5d58
commit
8993efc2a5
@ -1043,6 +1043,12 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(denominator > numerator) {
|
||||
err = PARAM_NUMBER_TOO_LARGE;
|
||||
break;
|
||||
}
|
||||
|
||||
global->ms_per_transfer = numerator/denominator;
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user