mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Don't str_copy into string itself
when reconnecting after server was full: [2020-09-25 15:39:34][client]: offline error='This server is full' Source and destination overlap in strncpy(0xd3328e2, 0xd3328e2, 255) at 0x483DFDC: strncpy (vg_replace_strmem.c:550) by 0x249180: str_copy (system.c:2328) by 0x27E1F5: CClient::Connect(char const*, char const*) (client.cpp:707) by 0x287864: CClient::Update() (client.cpp:2914) by 0x28891B: CClient::Run() (client.cpp:3216) by 0x28EDEC: main (client.cpp:4309)
This commit is contained in:
parent
32c77faecc
commit
8cdc4066ff
|
@ -704,7 +704,8 @@ void CClient::Connect(const char *pAddress, const char *pPassword)
|
||||||
Disconnect();
|
Disconnect();
|
||||||
|
|
||||||
m_ConnectionID = RandomUuid();
|
m_ConnectionID = RandomUuid();
|
||||||
str_copy(m_aServerAddressStr, pAddress, sizeof(m_aServerAddressStr));
|
if(pAddress != m_aServerAddressStr)
|
||||||
|
str_copy(m_aServerAddressStr, pAddress, sizeof(m_aServerAddressStr));
|
||||||
|
|
||||||
str_format(aBuf, sizeof(aBuf), "connecting to '%s'", m_aServerAddressStr);
|
str_format(aBuf, sizeof(aBuf), "connecting to '%s'", m_aServerAddressStr);
|
||||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aBuf);
|
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aBuf);
|
||||||
|
|
Loading…
Reference in a new issue