diff --git a/src/command.c b/src/command.c index 3ba7a2972..74a41abff 100644 --- a/src/command.c +++ b/src/command.c @@ -1739,6 +1739,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth) // send the value of the variable UINT8 buf[128]; UINT8 *p = buf; + if (!(server || (IsPlayerAdmin(consoleplayer)))) { CONS_Alert(CONS_NOTICE, "Only the server or admin can change: %s %s\n", var->name, var->string); diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 0f6b74f88..f82a6191e 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -182,14 +182,19 @@ void COM_Lua_f(void) len = (argc+1)*256; buf = malloc(len); + if (buf == NULL) + I_Error("Failed to allocate buffer for COM_Lua_f"); + p = buf; WRITEUINT8(p, argc); for (i = 0; i < argc; i++) WRITESTRINGN(p, COM_Argv(i), 255); - if (flags & 2) + + if (flags & COM_SPLITSCREEN) SendNetXCmdForPlayer(1, XD_LUACMD, buf, p-buf); else SendNetXCmd(XD_LUACMD, buf, p-buf); + free(buf); return; }