Skip to content

Commit de55d49

Browse files
committed
Fix motd undef behavior
Conditional jump or move depends on uninitialised value(s) at 0x2158DA: int IServer::SendPackMsg<CNetMsg_Sv_Motd, 0>(CNetMsg_Sv_Motd*, int, int) (server.h:73) by 0x1FE02F: CGameContext::SendMotd(int) (gamecontext.cpp:538) by 0x20A874: CGameContext::ConchainSpecialMotdupdate(IConsole::IResult*, void*, void (*)(IConsole::IResult*, void*), void*) (gamecontext.cpp:3124) by 0x145A23: CConsole::Con_Chain(IConsole::IResult*, void*) (console.cpp:1202) by 0x132086: CConsole::ExecuteLineStroked(int, char const*, int, bool) (console.cpp:528) by 0x1323A7: CConsole::ExecuteLine(char const*, int, bool) (console.cpp:582) by 0x1326B1: CConsole::ExecuteFile(char const*, int, bool, int) (console.cpp:625) by 0x1C60E9: main (server.cpp:3874) Uninitialised value was created by a heap allocation at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x1C5900: CreateServer() (server.cpp:3755) by 0x1C5C4C: main (server.cpp:3818)
1 parent 735b0bd commit de55d49

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

memcheck.supp

-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
{
2-
Motd
3-
Memcheck:Cond
4-
fun:_ZN7IServer11SendPackMsgI15CNetMsg_Sv_MotdLi0EEEiPT_ii
5-
fun:_ZN12CGameContext8SendMotdEi
6-
fun:_ZN12CGameContext25ConchainSpecialMotdupdateEPN8IConsole7IResultEPvPFvS2_S3_ES3_
7-
fun:_ZN8CConsole9Con_ChainEPN8IConsole7IResultEPv
8-
fun:_ZN8CConsole18ExecuteLineStrokedEiPKcib
9-
fun:_ZN8CConsole11ExecuteLineEPKcib
10-
fun:_ZN8CConsole11ExecuteFileEPKcibi
11-
fun:main
12-
}
131
{
142
DemoRecorderWrite
153
Memcheck:Param

src/engine/server/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ int CServer::Port() const
723723

724724
int CServer::MaxClients() const
725725
{
726-
return m_NetServer.MaxClients();
726+
return m_RunServer == UNINITIALIZED ? 0 : m_NetServer.MaxClients();
727727
}
728728

729729
int CServer::ClientCount() const

0 commit comments

Comments
 (0)