Cherry-pick bitcoin#30568: addrman: change internal id counting to int64_t#1453
Merged
delta1 merged 1 commit intoElementsProject:masterfrom May 1, 2025
Merged
Conversation
…int64_t 51f7668 addrman: change nid_type from int to int64_t (Martin Zumsande) 051ba32 addrman, refactor: introduce user-defined type for internal nId (Martin Zumsande) Pull request description: With `nIdCount` being incremented for each addr received, an attacker could cause an overflow in the past, see https://bitcoincore.org/en/2024/07/31/disclose-addrman-int-overflow/ Even though that attack was made infeasible indirectly by addr rate-limiting (PR #22387), to be on the safe side and prevent any regressions change the `nId`s used internally to `int64_t`. This is being done by first introducing a user-defined type for `nId`s in the first commit, and then updating it to `int64_t` (thanks sipa for help with this!). Note that `nId` is only used internally, it is not part of the serialization, so `peers.dat` should not be affected by this. I assume that the only reason this was not done in the past is to not draw attention to this previously undisclosed issue. ACKs for top commit: naumenkogs: ACK 51f7668 stratospher: ACK 51f7668. I think it's a good change to make the nId space large(64 bits) so that the nId values are distinct. achow101: ACK 51f7668 Tree-SHA512: 68d4b8b0269a01a9544bedfa7c1348ffde00a288537e4c8bf2b88372ac7d96c4566a44dd6b06285f2fcf31b4f9336761e3bca7253fbc20db5e0d04e887156224
delta1
approved these changes
May 1, 2025
delta1
added a commit
to delta1/elements
that referenced
this pull request
Jul 9, 2025
delta1
added a commit
to delta1/elements
that referenced
this pull request
Jul 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bitcoin/bitcoin#30568
https://bitcoincore.org/en/2025/03/31/disclose-cve-2024-52919/