- Added "special" console command for executing action specials.

- Fixed buffer overflow attack for DEM_RUNSCRIPT(2).

SVN r3088 (trunk)
This commit is contained in:
Randy Heit 2011-01-02 18:54:57 +00:00
commit 46ad4ec4bd
4 changed files with 80 additions and 3 deletions

View file

@ -57,6 +57,7 @@
#include "g_level.h"
#include "d_event.h"
#include "m_argv.h"
#include "p_lnspec.h"
int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net);
@ -2316,13 +2317,38 @@ void Net_DoCommand (int type, BYTE **stream, int player)
for (i = 0; i < argn; ++i)
{
arg[i] = ReadLong (stream);
int argval = ReadLong(stream);
if (i < countof(arg))
{
arg[i] = argval;
}
}
P_StartScript (players[player].mo, NULL, snum, level.mapname, false,
arg[0], arg[1], arg[2], type == DEM_RUNSCRIPT2, false, true);
}
break;
case DEM_RUNSPECIAL:
{
int snum = ReadByte(stream);
int argn = ReadByte(stream);
int arg[5] = { 0, 0, 0, 0, 0 };
for (i = 0; i < argn; ++i)
{
int argval = ReadLong(stream);
if (i < countof(arg))
{
arg[i] = argval;
}
}
if (!CheckCheatmode(player == consoleplayer))
{
LineSpecials[snum](NULL, players[player].mo, false, arg[0], arg[1], arg[2], arg[3], arg[4]);
}
}
break;
case DEM_CROUCH:
if (gamestate == GS_LEVEL && players[player].mo != NULL &&
players[player].health > 0 && !(players[player].oldbuttons & BT_JUMP))
@ -2521,6 +2547,10 @@ void Net_SkipCommand (int type, BYTE **stream)
skip = 3 + *(*stream + 2) * 4;
break;
case DEM_RUNSPECIAL:
skip = 2 + *(*stream + 1) * 4;
break;
case DEM_CONVREPLY:
skip = 3;
break;