Repository navigation
fix(libkernel): fail a short or long socket address like FreeBSD - #8154
Merged
oneandonlydean merged 2 commits intoOct 20, 2026
Merged
Conversation
bind, connect and sendto answered EFAULT for an address length below 2 and EAFNOSUPPORT for an AF_INET address below 16 or an AF_INET6 address below 28 bytes. FreeBSD 11.4's getsockaddr fails a length below 2 with EINVAL and above SOCK_MAXADDRLEN (255) with ENAMETOOLONG, and the protocols compare the length with sizeof(struct sockaddr_in) or sockaddr_in6 and fail with EINVAL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ess_length Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
10 tasks done
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.
What
Address()(Udp.cpp, used by bind, connect and sendto) now checks the length first like FreeBSD 11.4getsockaddr: above 255 bytesENAMETOOLONG, below 2EINVAL, then a null pointerEFAULT; an AF_INET address below 16 or an AF_INET6 address below 28 bytes fails withEINVALinstead ofEAFNOSUPPORT. Debt entry added for what stays different (an address longer thansockaddr_in/sockaddr_in6is still accepted; other families stillEAFNOSUPPORT).Fixes #8153
Tested
Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on
upstream/main34b1b77 + this branch:guest_socket_address_length:Exit code 0xc0000409without the change to Udp.cpp, passes with it.guest_socket_options,_stream_options,_timeouts,_read_write,_port_zero,_pair,_descriptors,_events,_connect_listening,_descriptor_flags,_error,guest_udp) pass.python tools/check_conventions.py --base upstream/main: passes.Checklist
main; no open PR touches socket address validation (searched: only closed fix(libkernel): fail a short or long socket address like FreeBSD #4920, the earlier version).mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code