mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #2573
7e7acdc3
daemon: catch out of range exceptions too when calling stoll/stoi (moneromooo-monero)
This commit is contained in:
commit
147ecb6b7a
1 changed files with 13 additions and 6 deletions
|
@ -346,7 +346,7 @@ bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
|
||||||
try {
|
try {
|
||||||
limit = std::stoll(args[0]);
|
limit = std::stoll(args[0]);
|
||||||
}
|
}
|
||||||
catch(const std::invalid_argument& ex) {
|
catch(const std::exception& ex) {
|
||||||
std::cout << "failed to parse argument" << std::endl;
|
std::cout << "failed to parse argument" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& arg
|
||||||
try {
|
try {
|
||||||
limit = std::stoll(args[0]);
|
limit = std::stoll(args[0]);
|
||||||
}
|
}
|
||||||
catch(const std::invalid_argument& ex) {
|
catch(const std::exception& ex) {
|
||||||
std::cout << "failed to parse argument" << std::endl;
|
std::cout << "failed to parse argument" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& a
|
||||||
try {
|
try {
|
||||||
limit = std::stoll(args[0]);
|
limit = std::stoll(args[0]);
|
||||||
}
|
}
|
||||||
catch(const std::invalid_argument& ex) {
|
catch(const std::exception& ex) {
|
||||||
std::cout << "failed to parse argument" << std::endl;
|
std::cout << "failed to parse argument" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ bool t_command_parser_executor::out_peers(const std::vector<std::string>& args)
|
||||||
limit = std::stoi(args[0]);
|
limit = std::stoi(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(std::invalid_argument& ex) {
|
catch(std::exception& ex) {
|
||||||
_erro("stoi exception");
|
_erro("stoi exception");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ bool t_command_parser_executor::hard_fork_info(const std::vector<std::string>& a
|
||||||
try {
|
try {
|
||||||
version = std::stoi(args[0]);
|
version = std::stoi(args[0]);
|
||||||
}
|
}
|
||||||
catch(std::invalid_argument& ex) {
|
catch(std::exception& ex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (version <= 0 || version > 255)
|
if (version <= 0 || version > 255)
|
||||||
|
@ -459,8 +459,15 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args)
|
||||||
std::string ip = args[0];
|
std::string ip = args[0];
|
||||||
time_t seconds = P2P_IP_BLOCKTIME;
|
time_t seconds = P2P_IP_BLOCKTIME;
|
||||||
if (args.size() > 1)
|
if (args.size() > 1)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
seconds = std::stoi(args[1]);
|
seconds = std::stoi(args[1]);
|
||||||
|
}
|
||||||
|
catch (const std::exception &e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (seconds == 0)
|
if (seconds == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue