Fix: crash when joining a server again after a TCP disconnect (#9453)

"my_client" wasn't always free'd when a game ended. "my_client"
keeps a reference inside the PT_NCLIENT pool. The rest of the
code assumes that when you are not in a game, it can freely
reset this pool.
In result: several ways to trigger a use-after-free.
This commit is contained in:
Patric Stout
2021-07-21 21:55:30 +02:00
committed by GitHub
parent 99d0d9be6b
commit 9cc706847c
2 changed files with 12 additions and 17 deletions

View File

@@ -48,7 +48,7 @@ NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool error)
_networking = false;
ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL);
return NETWORK_RECV_STATUS_CLIENT_QUIT;
return this->CloseConnection(NETWORK_RECV_STATUS_CLIENT_QUIT);
}
return this->CloseConnection(NETWORK_RECV_STATUS_CONNECTION_LOST);