blockchain_export: fix buffer overflow in exporter

Coverity 182550
This commit is contained in:
moneromooo-monero 2018-02-02 16:10:34 +00:00
parent f3f7da624d
commit 24803ed91f
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ void BlocksdatFile::write_block(const crypto::hash& block_hash)
{ {
crypto::hash hash; crypto::hash hash;
crypto::cn_fast_hash(m_hashes.data(), HASH_OF_HASHES_STEP * sizeof(crypto::hash), hash); crypto::cn_fast_hash(m_hashes.data(), HASH_OF_HASHES_STEP * sizeof(crypto::hash), hash);
memmove(m_hashes.data(), m_hashes.data() + HASH_OF_HASHES_STEP * sizeof(crypto::hash), (m_hashes.size() - HASH_OF_HASHES_STEP) * sizeof(crypto::hash)); memmove(m_hashes.data(), m_hashes.data() + HASH_OF_HASHES_STEP, (m_hashes.size() - HASH_OF_HASHES_STEP) * sizeof(crypto::hash));
m_hashes.resize(m_hashes.size() - HASH_OF_HASHES_STEP); m_hashes.resize(m_hashes.size() - HASH_OF_HASHES_STEP);
const std::string data(hash.data, sizeof(hash)); const std::string data(hash.data, sizeof(hash));
*m_raw_data_file << data; *m_raw_data_file << data;