avoid a buffer underflow

This commit is contained in:
Bill Currie 2005-03-24 15:00:37 +00:00
parent 63f9c77e11
commit b2a6a20426

View file

@ -76,7 +76,8 @@ GIB_Exec_Override_f (void)
if (!Cvar_Command ()
&& (cmd_warncmd->int_val || (developer && developer->int_val)))
Sys_Printf ("execing %s\n", Cmd_Argv (1));
if (!strcmp (Cmd_Argv (1) + strlen (Cmd_Argv (1)) - 4, ".gib")
if ((strlen (Cmd_Argv (1)) >= 4
&& !strcmp (Cmd_Argv (1) + strlen (Cmd_Argv (1)) - 4, ".gib"))
|| cbuf_active->interpreter == GIB_Interpreter ()) {
// GIB script, put it in a new buffer on the stack
cbuf_t *sub = Cbuf_PushStack (GIB_Interpreter ());