fix oob write when map has playerstarts for 32 players

playerstarts is MAXPLAYERS big, which is 16 for us
This commit is contained in:
Alug committed 2025-05-11 17:13:04 +02:00
1 parent d5583ba040
commit 93d87e1132
1 file changed
+11 -3
+11 -3
View File
@@ -11034,9 +11034,17 @@ void P_SpawnMapThing(mapthing_t *mthing)
// check for players specially
if (mthing->type > 0 && mthing->type <= 32)
{
// save spots for respawning in network games
if (!metalrecording)
playerstarts[mthing->type-1] = mthing;
if (mthing->type > MAXPLAYERS) // be wary of playerstarts size! playerstarts[MAXPLAYERS]
{
CONS_Alert(CONS_ERROR, "Excess player start detected %d This will crash vanilla clients!\n", mthing->type);
}
else
{
// save spots for respawning in network games
if (!metalrecording)
playerstarts[mthing->type-1] = mthing;
}
return;
}