Bounds check network_receive_level_spawn_info()

This commit is contained in:
David Joslin 2023-11-07 00:30:22 -08:00 committed by Agent X
parent 36e9274ef5
commit 74ea705f8b

View file

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