HLE/net: bound and check WSAConnectByList entries (#428) #498
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!498
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-498"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@axolotlpriv on GitHub · 2026-11-25 01:45 UTC · original
axolotlpriv:fix/wsa-connect-by-list-bounds→main· +192 −18 · 1 files · 1 commits · openWhat
WSAConnectByList built &[SocketAddress] directly from the title-supplied iAddressCount via std::slice::from_raw_parts, with no count bound, alignment guarantee, or readability check. A negative/zero or oversized count (such as x7fffffff on a single-entry buffer) either skipped vetting or constructed an out-of-bounds slice over unmapped or unrelated memory.
WSAConnectByList now checks that the list header is committed and readable, rejects counts outside 1..=64 with WSAEINVAL, and walks entries one by one with wrapping_add, VirtualQuery readability checks (WSAEFAULT on unreadable pages), and
ead_unaligned(). socket_addr likewise validates readability and reads unaligned headers/addresses instead of slicing len bytes blindly, and ind copies only the verified sockaddr bytes.
Fixes #428.
Testing
Added modules::net::tests::connect_by_list_validates_count_and_bounds covering i32::MAX, , -1, i32::MIN, and 65 counts (WSAEINVAL), a two-page PAGE_NOACCESS guard fixture catching truncated lists and unreadable headers (WSAEFAULT) as well as unreadable sockaddr pointers (WSAENETUNREACH), an unaligned [HOME, AWAY] list (WSAENETUNREACH), and a valid loopback connection. Existing tests pass unchanged.
Validated locally on Windows:
AI use: written and tested with AI assistance; reviewed before posting. No game files were used.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.