Bounds check network_receive_level_spawn_info()

This commit is contained in:
MysterD 2023-11-07 00:30:22 -08:00
parent 47be56e1c7
commit 8d9bc4cb73
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,10 @@ void network_receive_level_spawn_info(struct Packet* p) {
packet_read(p, &spawnInfoDeletionCount, sizeof(u8)); packet_read(p, &spawnInfoDeletionCount, sizeof(u8));
LOG_INFO("rx spawn info (count %d)", spawnInfoDeletionCount); LOG_INFO("rx spawn info (count %d)", spawnInfoDeletionCount);
if (spawnInfoDeletionCount <= 0) { return; } if (spawnInfoDeletionCount <= 0) { return; }
if (thisAreaIndex >= MAX_AREAS) {
LOG_ERROR("Receiving 'location response' with invalid areaIndex!");
return;
}
struct SpawnInfo* spawnInfo = gAreaData[thisAreaIndex].objectSpawnInfos; struct SpawnInfo* spawnInfo = gAreaData[thisAreaIndex].objectSpawnInfos;
u16 spawnInfoIndex = 0; u16 spawnInfoIndex = 0;