aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-10-23 19:09:18 +0200
committerRiccardo Spagni <ric@spagni.net>2016-10-23 19:09:18 +0200
commit4e98d2958c9950a1ae9054f20bf466563af5cd03 (patch)
tree7af0880a1c49b13a7f11fe852c5604ea3c4e7295
parentMerge pull request #1239 (diff)
parentwallet: sanity check on selected transfer indices in signed ptx (diff)
downloadmonero-4e98d2958c9950a1ae9054f20bf466563af5cd03.tar.xz
Merge pull request #1246
372f338 wallet: sanity check on selected transfer indices in signed ptx (moneromooo-monero)
-rw-r--r--src/wallet/wallet2.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index b499f6b24..23e016f7b 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2523,6 +2523,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;