Reject a throttle rate that does not parse

A discarded parse result left the rate at zero, which is unlimited.
This commit is contained in:
noctuum
2026-09-18 09:41:41 +05:00
committed by Jari Sundell
parent da9606bfae
commit 378c7ee854
+3 -1
View File
@@ -83,7 +83,9 @@ apply_throttle(const torrent::Object::list_type& args, bool up) {
throw torrent::input_error("Missing throttle rate for '" + name + "'.");
int64_t rate;
rpc::parse_whole_value_nothrow(arg_itr->as_string().c_str(), &rate);
if (!rpc::parse_whole_value_nothrow(arg_itr->as_string().c_str(), &rate))
throw torrent::input_error("Invalid throttle rate for '" + name + "'.");
if (rate < 0)
throw torrent::input_error("Throttle rate must be non-negative.");