Prevent signed overflow (UB) in SquirrelVM::GenerateUniqueKey()

This commit is contained in:
Alexander 'z33ky' Hirsch 2024-11-13 00:25:51 +01:00
parent 359fcb7196
commit 696036219e

View File

@ -2776,7 +2776,7 @@ void* SquirrelVM::GetInstanceValue(HSCRIPT hInstance, ScriptClassDesc_t* pExpect
bool SquirrelVM::GenerateUniqueKey(const char* pszRoot, char* pBuf, int nBufSize)
{
static int keyIdx = 0;
static unsigned keyIdx = 0;
// This gets used for script scope, still confused why it needs to be inside IScriptVM
// is it just to be a compatible name for CreateScope?
V_snprintf(pBuf, nBufSize, "%08X_%s", ++keyIdx, pszRoot);