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

Closed
davutsimsekk wants to merge 1 commit from upstream-pr/469 into main
davutsimsekk commented 2026-11-25 01:19:42 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by davutsimsekk on 2026-11-25T01:19:42Z.


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.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6594905510 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/469). Originally posted by [davutsimsekk](https://github.com/davutsimsekk) on 2026-11-25T01:19:42Z. --- `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.
kaayzouee commented 2026-11-25 02:10:09 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T01:41:17Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7149839250 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/469#issuecomment-7149839250). Originally posted by [kaayzouee](https://github.com/kaayzouee) on 2026-11-25T01:41:17Z. --- 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.
upstream-sync closed this pull request 2026-11-25 04:11:00 +00:00
davutsimsekk commented 2026-11-25 04:11:21 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by davutsimsekk on 2026-11-25T03:36:18Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:comment:7152069927 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/469#issuecomment-7152069927). Originally posted by [davutsimsekk](https://github.com/davutsimsekk) on 2026-11-25T03:36:18Z. --- Duplicate of #466, which implements the same 64-entry bound and an older branch. Closing this one in favor of it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!469
No description provided.