diff options
author | Andrew Chow <github@achow101.com> | 2022-10-20 13:24:57 -0400 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-10-28 17:59:30 +0800 |
commit | dedee6af572471b9beeebca9543934e788484b2e (patch) | |
tree | fdecd7d9d03783ac719bf663158f46e0873bea10 /src | |
parent | 931db785ee6f5c34e0f053314bc8c70b01642b72 (diff) | |
download | bitcoin-dedee6af572471b9beeebca9543934e788484b2e.tar.xz |
wallet: Check utxo prevout index out of bounds in sendall
Github-Pull: #26344
Rebased-From: b132c85650afb2182f2e58e903f3d6f86fd3fb22
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/rpc/spend.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index 7d105b35b8..bc65cbf7bf 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -1380,7 +1380,7 @@ RPCHelpMan sendall() throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Input not available. UTXO (%s:%d) was already spent.", input.prevout.hash.ToString(), input.prevout.n)); } const CWalletTx* tx{pwallet->GetWalletTx(input.prevout.hash)}; - if (!tx || !(pwallet->IsMine(tx->tx->vout[input.prevout.n]) & (coin_control.fAllowWatchOnly ? ISMINE_ALL : ISMINE_SPENDABLE))) { + if (!tx || input.prevout.n >= tx->tx->vout.size() || !(pwallet->IsMine(tx->tx->vout[input.prevout.n]) & (coin_control.fAllowWatchOnly ? ISMINE_ALL : ISMINE_SPENDABLE))) { throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Input not found. UTXO (%s:%d) is not part of wallet.", input.prevout.hash.ToString(), input.prevout.n)); } total_input_value += tx->tx->vout[input.prevout.n].nValue; |