mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-15 08:23:46 +02:00
Change CChain::Contains() to take reference
The `CChain::Contains()` method dereferences its input without checking, potentially resulting in nullptr-dereference if invoked with `nullptr`. To avoid this possibility, its input is changed to a reference instead. Call sites are adapted accoringly, extra nullptr-check is added as needed.
This commit is contained in:
@@ -1367,7 +1367,7 @@ const btck_BlockTreeEntry* btck_chain_get_by_height(const btck_Chain* chain, int
|
||||
int btck_chain_contains(const btck_Chain* chain, const btck_BlockTreeEntry* entry)
|
||||
{
|
||||
LOCK(::cs_main);
|
||||
return btck_Chain::get(chain).Contains(&btck_BlockTreeEntry::get(entry)) ? 1 : 0;
|
||||
return btck_Chain::get(chain).Contains(btck_BlockTreeEntry::get(entry)) ? 1 : 0;
|
||||
}
|
||||
|
||||
btck_BlockHeader* btck_block_header_create(const void* raw_block_header, size_t raw_block_header_len)
|
||||
|
||||
Reference in New Issue
Block a user