Remove static buffers from StringHelpers to prevent overwriting strings from another thread.

This commit is contained in:
Soggy_Pancake 2026-03-19 18:09:34 -07:00
parent 3f7745b262
commit 5d459c0ff9
15 changed files with 68 additions and 55 deletions

View file

@ -105,11 +105,11 @@ Connection::Connection(Socket *socket, const wstring& id, PacketListener *packet
m_hWakeReadThread = new C4JThread::Event;
m_hWakeWriteThread = new C4JThread::Event;
const char *szId = wstringtofilename(id);
std::string szId = wstringtofilename(id);
char readThreadName[256];
char writeThreadName[256];
sprintf_s(readThreadName, sizeof(readThreadName), "%.240s read\n", szId);
sprintf_s(writeThreadName, sizeof(writeThreadName), "%.240s write\n", szId);
sprintf_s(readThreadName, sizeof(readThreadName), "%.240s read\n", szId.c_str());
sprintf_s(writeThreadName, sizeof(writeThreadName), "%.240s write\n", szId.c_str());
readThread = new C4JThread(runRead, static_cast<void *>(this), readThreadName, READ_STACK_SIZE);
writeThread = new C4JThread(runWrite, this, writeThreadName, WRITE_STACK_SIZE);