net: bound WSAConnectByList's title-supplied count #469

Closed
github-bot wants to merge 1 commit from gh-pr/469/head into gh-pr/469/base
Owner

@⁠davutsimsekk on GitHub · 2026-11-25 01:19 UTC · original
davutsimsekk:fix/wsa-connect-list-count → main · +30 −4 · 1 files · 1 commits · closed without merging

WSAConnectByList read the title-supplied SOCKET_ADDRESS_LIST count as an i32 and passed it straight to std::slice::from_raw_parts. A negative or huge count (for example i32::MAX) built an unbounded slice before reachable() ran, so the shim hit undefined behaviour instead of refusing the call.

This bounds the count to 64 entries and returns WSAEINVAL for negative or oversized values. The count is read unaligned; lists within the bound are unchanged.

Fixes #428.

Test

a_socket_address_list_count_is_bounded checks 2 and 0 are accepted, while -1 and i32::MAX are refused.

  • cargo test -p victory-hle --lib: 97 passed, 0 failed
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean
  • rustfmt --edition 2024 --check crates/victory-hle/src/modules/net.rs: clean
  • No game data or GPU was used.
**@⁠davutsimsekk** on GitHub · 2026-11-25 01:19 UTC · [original](https://github.com/fxceless/victory-fork/pull/469) `davutsimsekk:fix/wsa-connect-list-count` → `main` · +30 −4 · 1 files · 1 commits · closed without merging `WSAConnectByList` read the title-supplied `SOCKET_ADDRESS_LIST` count as an `i32` and passed it straight to `std::slice::from_raw_parts`. A negative or huge count (for example `i32::MAX`) built an unbounded slice before `reachable()` ran, so the shim hit undefined behaviour instead of refusing the call. This bounds the count to 64 entries and returns `WSAEINVAL` for negative or oversized values. The count is read unaligned; lists within the bound are unchanged. Fixes #428. ## Test `a_socket_address_list_count_is_bounded` checks 2 and 0 are accepted, while -1 and `i32::MAX` are refused. - `cargo test -p victory-hle --lib`: 97 passed, 0 failed - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean - `rustfmt --edition 2024 --check crates/victory-hle/src/modules/net.rs`: clean - No game data or GPU was used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:44:04 +00:00
github-bot closed this pull request 2026-11-26 03:44:04 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 01:41 UTC · original

Is this a duplicate of #466?

Both bound the title-supplied WSAConnectByList count to 64 and reject invalid counts.

This is an automated message. If you believe it is incorrect, please reply with the relevant technical differences.

**@⁠kaayzouee** on GitHub · 2026-11-25 01:41 UTC · [original](https://github.com/fxceless/victory-fork/pull/469#issuecomment-7149839250) Is this a duplicate of #466? Both bound the title-supplied WSAConnectByList count to 64 and reject invalid counts. This is an automated message. If you believe it is incorrect, please reply with the relevant technical differences.
Author
Owner

@⁠davutsimsekk on GitHub · 2026-11-25 03:36 UTC · original

Duplicate of #466, which implements the same 64-entry bound and an older branch. Closing this one in favor of it.

**@⁠davutsimsekk** on GitHub · 2026-11-25 03:36 UTC · [original](https://github.com/fxceless/victory-fork/pull/469#issuecomment-7152069927) Duplicate of #466, which implements the same 64-entry bound and an older branch. Closing this one in favor of it.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.