diff options
author | Patric Stout <truebrain@openttd.org> | 2021-07-21 21:55:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 21:55:30 +0200 |
commit | 9cc706847cc92e8408426c78c3bee575c3323d15 (patch) | |
tree | dca75743cec2be0fc62073a8e966e53813f100b9 /src/network/core/tcp_game.cpp | |
parent | 99d0d9be6bb52e03ad3d772046c69bd7040e41ef (diff) | |
download | openttd-9cc706847cc92e8408426c78c3bee575c3323d15.tar.xz |
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.
Diffstat (limited to 'src/network/core/tcp_game.cpp')
-rw-r--r-- | src/network/core/tcp_game.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp index 84fb164de..7a1d18349 100644 --- a/src/network/core/tcp_game.cpp +++ b/src/network/core/tcp_game.cpp @@ -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); |