diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-04-29 08:17:32 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-06-14 08:47:29 +0000 |
commit | 0564da5fdc165948ba7c862fb81478f9287a072d (patch) | |
tree | 3a30a0c1ec0c5a8d8fa73b950c7251aa219d1e09 /src/blockchain_db/lmdb/db_lmdb.cpp | |
parent | abstract_tcp_server2: improve DoS resistance (diff) | |
download | monero-0564da5fdc165948ba7c862fb81478f9287a072d.tar.xz |
ensure no NULL is passed to memcpy
NULL is valid when size is 0, but memcpy uses nonnull attributes,
so let's not poke the bear
Diffstat (limited to 'src/blockchain_db/lmdb/db_lmdb.cpp')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index a03a0989b..f05eb0f30 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -1077,11 +1077,11 @@ void BlockchainLMDB::add_tx_amount_output_indices(const uint64_t tx_id, int result = 0; - int num_outputs = amount_output_indices.size(); + size_t num_outputs = amount_output_indices.size(); MDB_val_set(k_tx_id, tx_id); MDB_val v; - v.mv_data = (void *)amount_output_indices.data(); + v.mv_data = num_outputs ? (void *)amount_output_indices.data() : (void*)""; v.mv_size = sizeof(uint64_t) * num_outputs; // LOG_PRINT_L1("tx_outputs[tx_hash] size: " << v.mv_size); |