HLE/net: refuse a WSAConnectByList count the list cannot back #476
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/476"
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?
Imported from fxceless/victory-fork. Originally posted by iloveslopware on 2026-11-25T01:22:43Z.
WSAConnectByListturnediAddressCountinto a&[SocketAddress]of that length before any address was vetted, so a list holding one 16-byte entry withiAddressCount = 0x7FFFFFFFproduced a ~34 GB slice and read far past the title's allocation as pointers and lengths — undefined behavior beforereachable()could weigh in (#428).A
SOCKET_ADDRESS_LISTcarries no size the count could be checked against, so the count is the title's word alone. More candidates than any title offers (MAX_CONNECT_LIST, 64) are now refused withWSAEINVALand aFALSEreturn — the same fail-closed posture as the rest of this module — while honest lists reach the host unchanged and the vetting loop is untouched.The new test builds a one-entry list whose count claims
i32::MAXand asserts the call returns 0 withWSAEINVALset, refusing before the entries are walked.Fixes #428.
Verification:
cargo clippy --target x86_64-pc-windows-msvc --workspace --all-targets --locked -- -D warnings(clang-cl 23.1.5, cross-checked from Linux) passes on default features and on--all-features; this compiles the new test, which then runs in this repo's Windows CI.#[cfg(windows)]-gated, so the Linux build is untouched by construction;main's pre-existing non-Windows test-compile gaps are outside this change and covered by #449.No formatting-only churn: one const with its rationale, a four-line guard, one test.
Disclosure: written with AI assistance (GLM via OpenCode) — the fix, test, and cross-verification were drafted and run with the tool, following the report in #428. Reviewed and understood by the human submitting it.
Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T01:41:21Z.
Is this a duplicate of #466?
Both address #428 by rejecting oversized WSAConnectByList counts.
This is an automated message. If you believe it is incorrect, please reply with the relevant technical differences.
Imported from fxceless/victory-fork. Originally posted by iloveslopware on 2026-11-25T01:44:37Z.
Yes — #466 was opened five minutes before this one and covers the same defect more completely: it also refuses a negative
iAddressCount(which this change left falling to 0 and forwarding the list to the host unvetted), and it reads the entries one at a time withread_unalignedrather than forming a&[SocketAddress]. Its tests cover more ground too, including the host-connect path on real hardware. The cap (64) and the failure mode (WSAEINVAL+FALSE) are identical, so there is nothing here that #466 lacks — closing in its favor.Pull request closed