From 74ea705f8b8b8439b2ae140d780f6827eb1fcaee Mon Sep 17 00:00:00 2001 From: David Joslin Date: Tue, 7 Nov 2023 00:30:22 -0800 Subject: [PATCH] Bounds check network_receive_level_spawn_info() --- src/pc/network/packets/packet_level_spawn_info.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pc/network/packets/packet_level_spawn_info.c b/src/pc/network/packets/packet_level_spawn_info.c index e73c6aae..d2b2e6f2 100644 --- a/src/pc/network/packets/packet_level_spawn_info.c +++ b/src/pc/network/packets/packet_level_spawn_info.c @@ -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;