Skip to content

Commit f290486

Browse files
committed
Fix out of bounds access in Spawnpoints::Create
Also bump the maximum number of indicators to 64
1 parent 862fba1 commit f290486

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

gametypes/ctf/ctf_main.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ void GT_MatchStateStarted()
748748

749749
case MATCH_STATE_COUNTDOWN:
750750
GENERIC_SetUpCountdown();
751-
SpawnIndicators::Delete();
751+
SpawnIndicators::DeleteAll();
752752
firstSpawn = true;
753753
break;
754754

gametypes/ctftactics/ctf_main.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ void GT_MatchStateStarted()
804804

805805
case MATCH_STATE_COUNTDOWN:
806806
GENERIC_SetUpCountdown();
807-
SpawnIndicators::Delete();
807+
SpawnIndicators::DeleteAll();
808808
break;
809809

810810
case MATCH_STATE_PLAYTIME:

gametypes/dm.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ void GT_MatchStateStarted()
412412
gametype.pickableItemsMask = 0; // disallow item pickup
413413
gametype.dropableItemsMask = 0; // disallow item drop
414414
GENERIC_SetUpCountdown();
415-
SpawnIndicators::Delete();
415+
SpawnIndicators::DeleteAll();
416416
break;
417417

418418
case MATCH_STATE_PLAYTIME:

gametypes/duel.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ void GT_MatchStateStarted()
387387
gametype.pickableItemsMask = 0; // disallow item pickup
388388
gametype.dropableItemsMask = 0; // disallow item drop
389389
GENERIC_SetUpCountdown();
390-
SpawnIndicators::Delete();
390+
SpawnIndicators::DeleteAll();
391391
break;
392392

393393
case MATCH_STATE_PLAYTIME:

gametypes/ffa.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void GT_MatchStateStarted()
309309
gametype.pickableItemsMask = 0; // disallow item pickup
310310
gametype.dropableItemsMask = 0; // disallow item drop
311311
GENERIC_SetUpCountdown();
312-
SpawnIndicators::Delete();
312+
SpawnIndicators::DeleteAll();
313313
break;
314314

315315
case MATCH_STATE_PLAYTIME:

gametypes/generic/spawnpoints.as

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2020
// CPM-style spawn indicators for warmup.
2121
// Add from gametype scripts with:
2222
// CreateSpawnIndicators(<spawn entity>,TEAM_PLAYERS/TEAM_ALPHA/TEAM_BETA)
23-
// And remember to remove indicators after warmup: SpawnIndicators::Delete()
23+
// And remember to remove indicators after warmup: SpawnIndicators::DeleteAll()
2424

2525
class Spawnpoint
2626
{
@@ -95,7 +95,7 @@ class Spawnpoint
9595
namespace SpawnIndicators
9696
{
9797

98-
const int MAX_INDICATORS = 32;
98+
const uint MAX_INDICATORS = 64;
9999
array<Spawnpoint @> indicators(MAX_INDICATORS);
100100
uint numIndicators = 0;
101101

@@ -112,8 +112,8 @@ void Create( const String &className, int team )
112112
array<Entity @> @ents = G_FindByClassname( className );
113113

114114
uint maxIndicators = ents.size();
115-
if( maxIndicators > MAX_INDICATORS )
116-
maxIndicators = MAX_INDICATORS;
115+
if( numIndicators + maxIndicators > MAX_INDICATORS )
116+
maxIndicators = MAX_INDICATORS - numIndicators;
117117

118118
for( uint i = 0; i < maxIndicators; i++ )
119119
{
@@ -123,7 +123,7 @@ void Create( const String &className, int team )
123123
}
124124
}
125125

126-
void Delete()
126+
void DeleteAll()
127127
{
128128
for( uint i = 0; i < numIndicators; i++ ) {
129129
@indicators[i] = null;

gametypes/headhunt.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ void GT_MatchStateStarted()
645645
gametype.pickableItemsMask = 0; // disallow item pickup
646646
gametype.dropableItemsMask = 0; // disallow item drop
647647
GENERIC_SetUpCountdown();
648-
SpawnIndicators::Delete();
648+
SpawnIndicators::DeleteAll();
649649
break;
650650

651651
case MATCH_STATE_PLAYTIME:

gametypes/tdm.as

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ void GT_MatchStateStarted()
439439
gametype.dropableItemsMask = 0; // disallow item drop
440440

441441
GENERIC_SetUpCountdown();
442-
SpawnIndicators::Delete();
442+
SpawnIndicators::DeleteAll();
443443
break;
444444

445445
case MATCH_STATE_PLAYTIME:

0 commit comments

Comments
 (0)