Skip to content

Commit 6960362

Browse files
committed
Prevent signed overflow (UB) in SquirrelVM::GenerateUniqueKey()
1 parent 359fcb7 commit 6960362

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sp/src/vscript/vscript_squirrel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ void* SquirrelVM::GetInstanceValue(HSCRIPT hInstance, ScriptClassDesc_t* pExpect
27762776

27772777
bool SquirrelVM::GenerateUniqueKey(const char* pszRoot, char* pBuf, int nBufSize)
27782778
{
2779-
static int keyIdx = 0;
2779+
static unsigned keyIdx = 0;
27802780
// This gets used for script scope, still confused why it needs to be inside IScriptVM
27812781
// is it just to be a compatible name for CreateScope?
27822782
V_snprintf(pBuf, nBufSize, "%08X_%s", ++keyIdx, pszRoot);

0 commit comments

Comments
 (0)