shithub: choc

Download patch

ref: 775132361f9364295591a12b955a4507f07406c2
parent: 2344223e648ca693945fe014bb3162c272bf27ec
author: Simon Howard <fraggle@gmail.com>
date: Fri Oct 14 14:24:13 EDT 2011

Fix overflow of playeringame[] caused by smaller MAXPLAYERS.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2424

--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -1303,10 +1303,11 @@
     fixed_t x, y, z;
     mobj_t *mobj;
 
-    if (!playeringame[mthing->type - 1])
+    if (mthing->type - 1 >= MAXPLAYERS || !playeringame[mthing->type - 1])
     {                           // Not playing
         return;
     }
+
     p = &players[mthing->type - 1];
     if (p->playerstate == PST_REBORN)
     {