Skip to content

Commit

Permalink
addrman: change nid_type from int to int64_t
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mzumsande committed Aug 1, 2024
1 parent f3d45f2 commit e869860
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/addrman_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static constexpr int32_t ADDRMAN_BUCKET_SIZE_LOG2{6};
static constexpr int ADDRMAN_BUCKET_SIZE{1 << ADDRMAN_BUCKET_SIZE_LOG2};

/** User-defined type for the internally used nIds */
using nid_type = int;
using nid_type = int64_t;

/**
* Extended statistics about a CAddress
Expand Down

0 comments on commit e869860

Please sign in to comment.