aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-12-31 16:10:30 -0600
committerluigi1111 <luigi1111w@gmail.com>2018-12-31 16:10:30 -0600
commita872a2a41a07a50f6ac2dc7c93c4cf0c95575586 (patch)
tree4f3f76a6e7786f47559a3a3c32833b65cefda316
parentMerge pull request #4946 (diff)
parentsimplewallet: donate command validate amount (diff)
downloadmonero-a872a2a41a07a50f6ac2dc7c93c4cf0c95575586.tar.xz
Merge pull request #4948
1d892ec simplewallet: donate command validate amount (selsta)
-rw-r--r--src/simplewallet/simplewallet.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index a8cc81869..75cd31f19 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -6348,8 +6348,18 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
local_args.pop_back();
}
// get amount and pop
- amount_str = local_args.back();
- local_args.pop_back();
+ uint64_t amount;
+ bool ok = cryptonote::parse_amount(amount, local_args.back());
+ if (ok && amount != 0)
+ {
+ amount_str = local_args.back();
+ local_args.pop_back();
+ }
+ else
+ {
+ fail_msg_writer() << tr("amount is wrong: ") << local_args.back() << ", " << tr("expected number from 0 to ") << print_money(std::numeric_limits<uint64_t>::max());
+ return true;
+ }
// push back address, amount, payment id
std::string address_str;
if (m_wallet->nettype() != cryptonote::MAINNET)