WSAConnectByList reads at most 64 candidates and refuses a negative count #466
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!466
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-466"
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?
@Frtuchinno on GitHub · 2026-11-25 01:17 UTC · original
Frtuchinno:fix/wsaconnectbylist-count→main· +95 −9 · 1 files · 1 commits · openFixes #428.
WSAConnectByListtook the title'siAddressCountas the length of a slice with no upper bound. A count larger than the number of entries actually present made the vetting loop read whatever memory follows the list asSOCKET_ADDRESSvalues. A negative count became 0, so the list went on to the host without being vetted.Change (
crates/victory-hle/src/modules/net.rs):MAX_CONNECT_CANDIDATES(64) fails withWSAEINVALand the call returns FALSE. Nothing after the count is read, and the host never sees the list. Every candidate has to be loopback, and the host tries them one after another, so a legitimate list is a handful of entries.read_unalignedinstead of through a&[SocketAddress]. The loop still stops at the first candidate that isn't loopback (WSAENETUNREACH), as before.Test:
connect_by_list_vets_a_bounded_listcovers five lists:WSAEINVALi32::MAXwith one entry presentWSAEINVAL-1WSAEINVALWSAENETUNREACHOn the old code the 65-entry case reaches the host and connects (
left: 1, right: 0), so the test fails there.Checked on Windows 11 (RX 7800 XT), toolchain 1.98.1 on
a803c87:cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean, with and without--all-features.cargo test -p victory-hle --locked: 97 passed, 0 failed.No game run: this path isn't reached by the title's normal boot. Only
net.rschanges. Runningcargo fmtonmainalso reformats twelve other files in this crate, and those are left out of this PR.AI-assisted (Claude Code): it wrote the change and the test and ran the checks on my machine. I reviewed it before opening this PR.
🤖 Generated with Claude Code
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.