diff options
author | selsta <selsta@sent.at> | 2018-12-07 13:37:23 +0100 |
---|---|---|
committer | selsta <selsta@sent.at> | 2018-12-07 13:43:21 +0100 |
commit | 1d892ec88122be46fe7592cfd1cd60e5b3adfa68 (patch) | |
tree | 1a0624e4b3e7ae175aa5028ab7140f9b7e98fc39 | |
parent | Merge pull request #4879 (diff) | |
download | monero-1d892ec88122be46fe7592cfd1cd60e5b3adfa68.tar.xz |
simplewallet: donate command validate amount
Diffstat (limited to '')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index bcf6acbd5..7e974bc50 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -5970,8 +5970,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 local_args.push_back(MONERO_DONATION_ADDR); local_args.push_back(amount_str); |