diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-01-04 12:18:07 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2024-01-04 16:21:37 +0000 |
commit | ccf00b1e6eb811a3af2c22518a832dd9a51f8aa4 (patch) | |
tree | bb1d4b0fa2757491cf576cf0ee43348ef64f46dc /src/wallet | |
parent | 40252e184eb188c4af767adb4918f729015910e8 (diff) |
wallet: Fix use-after-free in WalletBatch::EraseRecords
Github-Pull: #29176
Rebased-From: faebf1df2afe207f5d2d4f73f50ac66824fe34bb
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/walletdb.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 92eca46f05..3a40b7a34f 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -1401,13 +1401,13 @@ bool WalletBatch::EraseRecords(const std::unordered_set<std::string>& types) } // Make a copy of key to avoid data being deleted by the following read of the type - Span key_data{key}; + const SerializeData key_data{key.begin(), key.end()}; std::string type; key >> type; if (types.count(type) > 0) { - if (!m_batch->Erase(key_data)) { + if (!m_batch->Erase(Span{key_data})) { cursor.reset(nullptr); m_batch->TxnAbort(); return false; // erase failed |