fix: Address6.fromURL lets port 65536 through as valid#211
Open
chatman-media wants to merge 1 commit into
Open
fix: Address6.fromURL lets port 65536 through as valid#211chatman-media wants to merge 1 commit into
chatman-media wants to merge 1 commit into
Conversation
Valid ports are 0-65535 (16-bit), but the range check used `> 65536`, so a port of exactly 65536 slipped through instead of being nulled out like every other out-of-range value. Looks like a plain off-by-one that's been there since the very first commit. Updated the two existing tests that had baked the wrong expectation in and added one pinning 65535 as the actual max.
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.
Noticed
fromURLtreats 65536 as an in-range port when it's actually one past the max (valid ports are 0-65535, it's a 16-bit field). So[::1]:65536comes back withport: 65536instead of being squelched tonulllike every other out-of-range value. Looks like a straight off-by-one that's been sitting there since the original commit.Fixed the bound and updated the two existing tests that were asserting the wrong value, plus added one that pins 65535 as the actual ceiling.