diff options
author | unknown <E:\Ladik\Mail> | 2015-04-01 06:52:50 +0200 |
---|---|---|
committer | unknown <E:\Ladik\Mail> | 2015-04-01 06:52:50 +0200 |
commit | 93370897471cb7bff861f9e961ff36e6ce46a5e8 (patch) | |
tree | 2e650adc65630f70a76afe4f4e7647849c2ce5b2 /src/SFileReadFile.cpp | |
parent | e5b9f5132a9010a36db81788e10bb1be07ccf410 (diff) |
+ Better handling of MPQs corrupted by yet another silly MPQ protector
Diffstat (limited to 'src/SFileReadFile.cpp')
-rw-r--r-- | src/SFileReadFile.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/SFileReadFile.cpp b/src/SFileReadFile.cpp index 02def18..2451865 100644 --- a/src/SFileReadFile.cpp +++ b/src/SFileReadFile.cpp @@ -81,14 +81,14 @@ static int ReadMpqSectors(TMPQFile * hf, LPBYTE pbBuffer, DWORD dwByteOffset, DW // return nError; // } - // If the file is compressed, also allocate secondary buffer - pbInSector = pbRawSector = STORM_ALLOC(BYTE, dwBytesToRead); - if(pbRawSector == NULL) - return ERROR_NOT_ENOUGH_MEMORY; - // Assign the temporary buffer as target for read operation dwRawSectorOffset = hf->SectorOffsets[dwSectorIndex]; dwRawBytesToRead = hf->SectorOffsets[dwSectorIndex + dwSectorsToRead] - dwRawSectorOffset; + + // If the file is compressed, also allocate secondary buffer + pbInSector = pbRawSector = STORM_ALLOC(BYTE, dwRawBytesToRead); + if(pbRawSector == NULL) + return ERROR_NOT_ENOUGH_MEMORY; } // Calculate raw file offset where the sector(s) are stored. |