Skip to content

fix: Address6.fromURL lets port 65536 through as valid#211

Open
chatman-media wants to merge 1 commit into
beaugunderson:mainfrom
chatman-media:fix/fromurl-port-off-by-one
Open

fix: Address6.fromURL lets port 65536 through as valid#211
chatman-media wants to merge 1 commit into
beaugunderson:mainfrom
chatman-media:fix/fromurl-port-off-by-one

Conversation

@chatman-media

Copy link
Copy Markdown

Noticed fromURL treats 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]:65536 comes back with port: 65536 instead of being squelched to null like 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.

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.

@m89sbyw4tk-glitch m89sbyw4tk-glitch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go

@m89sbyw4tk-glitch m89sbyw4tk-glitch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dog

@m89sbyw4tk-glitch m89sbyw4tk-glitch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants