diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-10-22 18:07:26 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-10-22 18:07:26 +0100 |
commit | 372f33868230059b03ee09b3fa2ced0f94c6535d (patch) | |
tree | bde1459d37c2f7fdc91c59749515ed38ac22e246 /src | |
parent | Merge pull request #1237 (diff) | |
download | monero-372f33868230059b03ee09b3fa2ced0f94c6535d.tar.xz |
wallet: sanity check on selected transfer indices in signed ptx
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/wallet2.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 6a60ebe28..d691793cd 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2524,6 +2524,13 @@ void wallet2::commit_tx(pending_tx& ptx) THROW_WALLET_EXCEPTION_IF(daemon_send_resp.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "sendrawtransaction"); THROW_WALLET_EXCEPTION_IF(daemon_send_resp.status != CORE_RPC_STATUS_OK, error::tx_rejected, ptx.tx, daemon_send_resp.status, daemon_send_resp.reason); + // sanity checks + for (size_t idx: ptx.selected_transfers) + { + THROW_WALLET_EXCEPTION_IF(idx >= m_transfers.size(), error::wallet_internal_error, + "Bad output index in selected transfers: " + boost::lexical_cast<std::string>(idx)); + } + txid = get_transaction_hash(ptx.tx); crypto::hash payment_id = cryptonote::null_hash; std::vector<cryptonote::tx_destination_entry> dests; |