Fix server resource leaks during client reconnect #281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a client reconnects using the same IP and port as a previous connection, the engine tries to use the same client slot as the previous connection. If a disconnect command from the client was not received first, the existing slot is not properly freed before starting the new connection.
This can be abused to crash a server by reconnecting MAX_FILE_HANDLES (64) times during a UDP download. It also allows bugs in unpatched mods that can for example cause the CTF flag to disappear from the game if the player holding it reconnects.
This fix ignores the
this doesn't work because it nukes the players userinfo
comment from the original Q3 code. At this point in the connection the new userinfo is stored in a local variable that shouldn't be affected by the game module disconnect, and the client slot userinfo will be wiped afterwards anyway. I suspect this comment is incorrect or a remnant of an old version of the codebase.