mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Engine: fix heap buffer overflow
Should always leave 1 byte for the null terminator in the persona name buffer.
This commit is contained in:
parent
da6ffe9005
commit
e8fe12b4fd
@ -43,12 +43,11 @@ static void SetName_f(const CCommand& args)
|
||||
|
||||
const size_t nLen = strlen(pszName);
|
||||
|
||||
if (nLen > MAX_PERSONA_NAME_LEN)
|
||||
if (nLen >= MAX_PERSONA_NAME_LEN)
|
||||
return;
|
||||
|
||||
// Update nucleus name.
|
||||
memset(g_PersonaName, '\0', MAX_PERSONA_NAME_LEN);
|
||||
strncpy(g_PersonaName, pszName, nLen);
|
||||
strncpy(g_PersonaName, pszName, nLen+1);
|
||||
}
|
||||
static void Reconnect_f(const CCommand& args)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user