From 29d9615f7b918821285a514c08b4be6dd4b3abf6 Mon Sep 17 00:00:00 2001 From: MysterD Date: Fri, 4 Mar 2022 20:29:05 -0800 Subject: [PATCH] More sanity checks in network_receive_area() --- src/pc/network/packets/packet_area.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pc/network/packets/packet_area.c b/src/pc/network/packets/packet_area.c index ea52fe4d..17da6739 100644 --- a/src/pc/network/packets/packet_area.c +++ b/src/pc/network/packets/packet_area.c @@ -211,7 +211,7 @@ void network_receive_area(struct Packet* p) { struct SyncObject* so = &gSyncObjects[syncId]; - if (so == NULL) { + if (so == NULL || syncId >= MAX_SYNC_OBJECTS) { LOG_ERROR("rx area: Sync object was NULL, Skipping respawner."); LOG_DEBUG("rx area debug: Sync Object DEBUG:\n\n \ POS X: %f\n \ @@ -240,8 +240,10 @@ void network_receive_area(struct Packet* p) { } struct Object* o = so->o; - o->oSyncID = 0; - o->activeFlags = ACTIVE_FLAG_DEACTIVATED; + if (o != NULL) { + o->oSyncID = 0; + o->activeFlags = ACTIVE_FLAG_DEACTIVATED; + } if (respawner != NULL) { so->o = respawner; } LOG_INFO("rx respawner replaced!");