forked from ddnet/ddnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Teehistorian server crash with MSVC due to uninitialized memory
The variable `CServer::CClient::m_Authed` and the function `IServer::GetAuthedState` may only be used when the client slot is not empty, as the authed state is uninitialized before a client slot has been used for the first time. When compiling the server with MSVC the variable is not zero-initialized like with other compilers currently. This was causing the server compiled with MSVC to crash on start when Teehistorian is enabled, as empty clients were incorrectly considered as authenticated for recording the initial auth state to the Teehistorian file. For these uninitialized clients, the `IServer::GetAuthName` function was returning `nullptr` which was then causing the `CPacker::AddString` function to crash when trying to pack the `nullptr` string. The separate `IServer::ClientAuthed` function is replaced with `IServer::GetAuthedState` function.
- Loading branch information
Showing
5 changed files
with
14 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters