Skip to content

Commit dedee6a

Browse files
achow101fanquake
authored andcommitted
wallet: Check utxo prevout index out of bounds in sendall
Github-Pull: #26344 Rebased-From: b132c85
1 parent 931db78 commit dedee6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wallet/rpc/spend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ RPCHelpMan sendall()
13801380
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Input not available. UTXO (%s:%d) was already spent.", input.prevout.hash.ToString(), input.prevout.n));
13811381
}
13821382
const CWalletTx* tx{pwallet->GetWalletTx(input.prevout.hash)};
1383-
if (!tx || !(pwallet->IsMine(tx->tx->vout[input.prevout.n]) & (coin_control.fAllowWatchOnly ? ISMINE_ALL : ISMINE_SPENDABLE))) {
1383+
if (!tx || input.prevout.n >= tx->tx->vout.size() || !(pwallet->IsMine(tx->tx->vout[input.prevout.n]) & (coin_control.fAllowWatchOnly ? ISMINE_ALL : ISMINE_SPENDABLE))) {
13841384
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Input not found. UTXO (%s:%d) is not part of wallet.", input.prevout.hash.ToString(), input.prevout.n));
13851385
}
13861386
total_input_value += tx->tx->vout[input.prevout.n].nValue;

0 commit comments

Comments
 (0)