Fixed bugs

This commit is contained in:
Ladislav Zezula
2023-02-02 00:22:24 +01:00
parent 50f811e590
commit 999ee276cf
8 changed files with 600 additions and 505 deletions

View File

@@ -683,7 +683,7 @@ DWORD ConvertMpqHeaderToFormat4(
return ERROR_FAKE_MPQ_HEADER;
// Check for malformed MPQs
if(pHeader->wFormatVersion != MPQ_FORMAT_VERSION_4 || (ByteOffset + pHeader->ArchiveSize64) != FileSize || (ByteOffset + pHeader->HiBlockTablePos64) >= FileSize)
if(pHeader->wFormatVersion != MPQ_FORMAT_VERSION_4 || (ByteOffset + pHeader->ArchiveSize64) > FileSize || (ByteOffset + pHeader->HiBlockTablePos64) >= FileSize)
{
pHeader->wFormatVersion = MPQ_FORMAT_VERSION_4;
pHeader->dwHeaderSize = MPQ_HEADER_SIZE_V4;