From 2827c523ce7fec4e6da7cd8a77be6a5c6ad8aab3 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 23 Apr 2022 15:08:33 -0700 Subject: [PATCH] Fix memory corruption in download --- src/pc/network/packets/packet_download.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pc/network/packets/packet_download.c b/src/pc/network/packets/packet_download.c index 98883717..2996c6ad 100644 --- a/src/pc/network/packets/packet_download.c +++ b/src/pc/network/packets/packet_download.c @@ -68,9 +68,11 @@ static void mark_groups_loaded_from_hash(void) { u64 ogIndexStart = fileStartOffset / GROUP_SIZE; u64 ogIndexEnd = (fileStartOffset + mod->size) / GROUP_SIZE; do { - LOG_INFO("Marking group as required: %llu (%s)", ogIndexStart, file->relativePath); - offsetGroupRequired[ogIndexStart] = 1; - ogIndexStart++; + if (ogIndexStart < sOffsetGroupCount) { + LOG_INFO("Marking group as required: %llu (%s)", ogIndexStart, file->relativePath); + offsetGroupRequired[ogIndexStart] = 1; + ogIndexStart++; + } } while (ogIndexStart <= ogIndexEnd); } fileStartOffset += file->size;