mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 12:01:47 +00:00
Check Lua stack before pushing cons args
Prevents a Lua stack overrun when executing absurd console commands for local-only lua commands.
This commit is contained in:
parent
6d64d15216
commit
63ff2f3f66
1 changed files with 5 additions and 0 deletions
|
|
@ -187,6 +187,11 @@ void COM_Lua_f(void)
|
||||||
I_Assert(lua_isfunction(gL, -1));
|
I_Assert(lua_isfunction(gL, -1));
|
||||||
lua_remove(gL, -2); // pop command info table
|
lua_remove(gL, -2); // pop command info table
|
||||||
|
|
||||||
|
if (!lua_checkstack(gL, COM_Argc() + 1))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "lua command stack overflow (%d, need %s more)\n", lua_gettop(gL), sizeu1(COM_Argc() + 1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
LUA_PushUserdata(gL, &players[playernum], META_PLAYER);
|
LUA_PushUserdata(gL, &players[playernum], META_PLAYER);
|
||||||
for (i = 1; i < COM_Argc(); i++)
|
for (i = 1; i < COM_Argc(); i++)
|
||||||
lua_pushstring(gL, COM_Argv(i));
|
lua_pushstring(gL, COM_Argv(i));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue