aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2022-10-20 13:24:57 -0400
committerAndrew Chow <github@achow101.com>2022-10-20 13:24:57 -0400
commitb132c85650afb2182f2e58e903f3d6f86fd3fb22 (patch)
tree8683940d08d4b91141fdd003fc91137cec84856a /src/wallet/rpc
parent708b72b7151c855cb5dac2fb6a81e8f35153c46f (diff)
downloadbitcoin-b132c85650afb2182f2e58e903f3d6f86fd3fb22.tar.xz
wallet: Check utxo prevout index out of bounds in sendall
Diffstat (limited to 'src/wallet/rpc')
-rw-r--r--src/wallet/rpc/spend.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index e84fb6c661..6cb33fc11e 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -1379,7 +1379,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;