aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-10-15 18:34:47 +0200
committerRiccardo Spagni <ric@spagni.net>2017-10-15 18:34:48 +0200
commit147ecb6b7a1e1b7f5337365b136cb5d65b1d8546 (patch)
treee2d9d1ba209f14bf5c91a0be09329f86189b0882
parentMerge pull request #2571 (diff)
parentdaemon: catch out of range exceptions too when calling stoll/stoi (diff)
downloadmonero-147ecb6b7a1e1b7f5337365b136cb5d65b1d8546.tar.xz
Merge pull request #2573
7e7acdc3 daemon: catch out of range exceptions too when calling stoll/stoi (moneromooo-monero)
-rw-r--r--src/daemon/command_parser_executor.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index 50a63d955..ddb5e95df 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -346,7 +346,7 @@ bool t_command_parser_executor::set_limit(const std::vector<std::string>& args)
try {
limit = std::stoll(args[0]);
}
- catch(const std::invalid_argument& ex) {
+ catch(const std::exception& ex) {
std::cout << "failed to parse argument" << std::endl;
return false;
}
@@ -366,7 +366,7 @@ bool t_command_parser_executor::set_limit_up(const std::vector<std::string>& arg
try {
limit = std::stoll(args[0]);
}
- catch(const std::invalid_argument& ex) {
+ catch(const std::exception& ex) {
std::cout << "failed to parse argument" << std::endl;
return false;
}
@@ -386,7 +386,7 @@ bool t_command_parser_executor::set_limit_down(const std::vector<std::string>& a
try {
limit = std::stoll(args[0]);
}
- catch(const std::invalid_argument& ex) {
+ catch(const std::exception& ex) {
std::cout << "failed to parse argument" << std::endl;
return false;
}
@@ -405,7 +405,7 @@ bool t_command_parser_executor::out_peers(const std::vector<std::string>& args)
limit = std::stoi(args[0]);
}
- catch(std::invalid_argument& ex) {
+ catch(std::exception& ex) {
_erro("stoi exception");
return false;
}
@@ -435,7 +435,7 @@ bool t_command_parser_executor::hard_fork_info(const std::vector<std::string>& a
try {
version = std::stoi(args[0]);
}
- catch(std::invalid_argument& ex) {
+ catch(std::exception& ex) {
return false;
}
if (version <= 0 || version > 255)
@@ -460,7 +460,14 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args)
time_t seconds = P2P_IP_BLOCKTIME;
if (args.size() > 1)
{
- seconds = std::stoi(args[1]);
+ try
+ {
+ seconds = std::stoi(args[1]);
+ }
+ catch (const std::exception &e)
+ {
+ return false;
+ }
if (seconds == 0)
{
return false;