Skip to content
Snippets Groups Projects
Commit 73cf1903 authored by Eidolon's avatar Eidolon
Browse files

Check Lua stack before pushing cons args

Prevents a Lua stack overrun when executing absurd console commands for
local-only lua commands.
parent 388a72a8
No related branches found
No related tags found
No related merge requests found
......@@ -184,6 +184,11 @@ void COM_Lua_f(void)
I_Assert(lua_isfunction(gL, -1));
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);
for (i = 1; i < COM_Argc(); i++)
lua_pushstring(gL, COM_Argv(i));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment