HLE/net: bound and check WSAConnectByList entries (#428) #498

Open
github-bot wants to merge 1 commit from github-bot/gh-498 into main AGit
Owner

@⁠axolotlpriv on GitHub · 2026-11-25 01:45 UTC · original
axolotlpriv:fix/wsa-connect-by-list-bounds → main · +192 −18 · 1 files · 1 commits · open

What

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:

  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test --workspace --locked
  • cargo xtask policy

AI use: written and tested with AI assistance; reviewed before posting. No game files were used.

**@⁠axolotlpriv** on GitHub · 2026-11-25 01:45 UTC · [original](https://github.com/fxceless/victory-fork/pull/498) `axolotlpriv:fix/wsa-connect-by-list-bounds` → `main` · +192 −18 · 1 files · 1 commits · open ## What 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: - cargo clippy --workspace --all-targets --locked -- -D warnings - cargo clippy --workspace --all-targets --all-features --locked -- -D warnings - cargo test --workspace --locked - cargo xtask policy **AI use:** written and tested with AI assistance; reviewed before posting. No game files were used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:44:45 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/498/head:github-bot/gh-498'
git switch 'github-bot/gh-498'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-498'
git switch 'github-bot/gh-498'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-498'
git switch 'github-bot/gh-498'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-498'
git switch 'main'
git merge --squash 'github-bot/gh-498'
git switch 'main'
git merge --ff-only 'github-bot/gh-498'
git switch 'main'
git merge 'github-bot/gh-498'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.