mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #3987
3987: Fix client use-after-free reported by mmmds r=def- a=ChillerDragon
Fix https://github.com/teeworlds/teeworlds/issues/2645
The `Sv_ReadyToEnter` net message is only valid while we're still
loading stuff, it is used to signal that we can send the `ENTERGAME`
system message. Simply ignoring the server message while we're in the
wrong part of the state machine works.
(cherry picked from commit a97f8a22de
)
## Checklist
- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
b475d4ffc5
|
@ -655,6 +655,12 @@ void CClient::EnterGame()
|
|||
if(State() == IClient::STATE_DEMOPLAYBACK)
|
||||
return;
|
||||
|
||||
if(State() == IClient::STATE_ONLINE)
|
||||
{
|
||||
// Don't reset everything while already in game.
|
||||
return;
|
||||
}
|
||||
|
||||
// now we will wait for two snapshots
|
||||
// to finish the connection
|
||||
SendEnterGame();
|
||||
|
|
Loading…
Reference in a new issue