mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-04 21:29:21 +00:00
Restrict parse value to strtoll with restrictions on input.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
#include <torrent/download/resource_manager.h>
|
||||
@@ -232,6 +233,9 @@ apply_cg_max_set(const torrent::Object::list_type& args, bool is_up) {
|
||||
int64_t second_arg = 0;
|
||||
rpc::parse_whole_value(args.back().as_string().c_str(), &second_arg);
|
||||
|
||||
if (second_arg < -1 || second_arg > std::numeric_limits<uint32_t>::max())
|
||||
throw torrent::input_error("Max unchoked must be between -1 and 4294967295.");
|
||||
|
||||
if (is_up)
|
||||
cg_get_group(args.front())->up_queue()->set_max_unchoked(second_arg);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user