aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-07-13 00:39:54 -0400
committerluigi1111 <luigi1111w@gmail.com>2022-07-13 00:39:54 -0400
commitcfdee9ba69244b922d0e286a2ac8ed55c165d840 (patch)
treeac2b7c9b4d811bc75ad8f4ed11448762f792b21d /src
parentMerge pull request #8149 (diff)
parentwallet2: prevent crash when reading tx w/fewer outputs than expected (diff)
downloadmonero-cfdee9ba69244b922d0e286a2ac8ed55c165d840.tar.xz
Merge pull request #8421
bd1e7c5 wallet2: prevent crash when reading tx w/fewer outputs than expected (j-berman)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index aa00d6c03..836373939 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -349,6 +349,8 @@ private:
uint64_t amount() const { return m_amount; }
const crypto::public_key get_public_key() const {
crypto::public_key output_public_key;
+ THROW_WALLET_EXCEPTION_IF(m_tx.vout.size() <= m_internal_output_index,
+ error::wallet_internal_error, "Too few outputs, outputs may be corrupted");
THROW_WALLET_EXCEPTION_IF(!get_output_public_key(m_tx.vout[m_internal_output_index], output_public_key),
error::wallet_internal_error, "Unable to get output public key from output");
return output_public_key;