diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-10-15 17:26:46 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-01-06 12:57:21 -0500 |
commit | deaa6dd144f5650b385658a0c4f9a014aff8dde2 (patch) | |
tree | 21470cf99b54531eb03c5143cc3400e0495fdbfa /src/wallet/psbtwallet.cpp | |
parent | f1ef7f0aa46338f4cd8de79696027a1bf868f359 (diff) | |
download | bitcoin-deaa6dd144f5650b385658a0c4f9a014aff8dde2.tar.xz |
psbt: check output index is within bounds before accessing
Diffstat (limited to 'src/wallet/psbtwallet.cpp')
-rw-r--r-- | src/wallet/psbtwallet.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wallet/psbtwallet.cpp b/src/wallet/psbtwallet.cpp index 96c1ad8d3f..3e6386a63f 100644 --- a/src/wallet/psbtwallet.cpp +++ b/src/wallet/psbtwallet.cpp @@ -44,6 +44,9 @@ TransactionError FillPSBT(const CWallet* pwallet, PartiallySignedTransaction& ps if (!input.witness_utxo.IsNull()) { script = input.witness_utxo.scriptPubKey; } else if (input.non_witness_utxo) { + if (txin.prevout.n >= input.non_witness_utxo->vout.size()) { + return TransactionError::MISSING_INPUTS; + } script = input.non_witness_utxo->vout[txin.prevout.n].scriptPubKey; } else { // There's no UTXO so we can just skip this now |