mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
addrman: change nid_type from int to int64_t
With nId being incremented for each addr received, an attacker could cause an overflow in the past. (https://bitcoincore.org/en/2024/07/31/disclose-addrman-int-overflow/) Even though that attack was made infeasible by rate-limiting (PR #22387), to be on the safe side change the type to an int64_t.
This commit is contained in:
parent
051ba3290e
commit
51f7668d31
1 changed files with 6 additions and 2 deletions
|
@ -32,8 +32,12 @@ static constexpr int ADDRMAN_NEW_BUCKET_COUNT{1 << ADDRMAN_NEW_BUCKET_COUNT_LOG2
|
||||||
static constexpr int32_t ADDRMAN_BUCKET_SIZE_LOG2{6};
|
static constexpr int32_t ADDRMAN_BUCKET_SIZE_LOG2{6};
|
||||||
static constexpr int ADDRMAN_BUCKET_SIZE{1 << ADDRMAN_BUCKET_SIZE_LOG2};
|
static constexpr int ADDRMAN_BUCKET_SIZE{1 << ADDRMAN_BUCKET_SIZE_LOG2};
|
||||||
|
|
||||||
/** User-defined type for the internally used nIds */
|
/**
|
||||||
using nid_type = int;
|
* User-defined type for the internally used nIds
|
||||||
|
* This used to be int, making it feasible for attackers to cause an overflow,
|
||||||
|
* see https://bitcoincore.org/en/2024/07/31/disclose-addrman-int-overflow/
|
||||||
|
*/
|
||||||
|
using nid_type = int64_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended statistics about a CAddress
|
* Extended statistics about a CAddress
|
||||||
|
|
Loading…
Add table
Reference in a new issue