Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




ShadowFlare [Sun, 26 Jul 2009 22:41:43 +0000 (16:41 -0600)]
SFmpqapi.cpp

index a42fa43..55f9fb8 100644 (file)
@@ -1520,7 +1520,7 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                for (i=0;i<mpqOpenArc->MpqHeader.dwHashTableSize;i++) {
                        lpListBuffer[i].dwFileExists = 0;
                        lpListBuffer[i].szFileName[0] = 0;
-                       if ((mpqOpenArc->lpHashTable[i].dwBlockTableIndex&0xFFFFFFFE)!=0xFFFFFFFE) {
+                       if ((mpqOpenArc->lpHashTable[i].dwBlockTableIndex&0xFFFFFFFE)!=0xFFFFFFFE && mpqOpenArc->lpHashTable[i].dwBlockTableIndex < mpqOpenArc->MpqHeader.dwBlockTableSize) {
                                lpListBuffer[i].lcLocale = mpqOpenArc->lpHashTable[i].lcLocale;
                                DWORD dwBlockIndex = mpqOpenArc->lpHashTable[i].dwBlockTableIndex;
                                lpListBuffer[i].dwCompressedSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwCompressedSize;
@@ -1684,7 +1684,7 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
        for (i=0;i<mpqOpenArc->MpqHeader.dwHashTableSize;i++) {
                lpListBuffer[i].dwFileExists = 0;
                lpListBuffer[i].szFileName[0] = 0;
-               if ((mpqOpenArc->lpHashTable[i].dwBlockTableIndex&0xFFFFFFFE)!=0xFFFFFFFE) {
+               if ((mpqOpenArc->lpHashTable[i].dwBlockTableIndex&0xFFFFFFFE)!=0xFFFFFFFE && mpqOpenArc->lpHashTable[i].dwBlockTableIndex < mpqOpenArc->MpqHeader.dwBlockTableSize) {
                        lpListBuffer[i].lcLocale = mpqOpenArc->lpHashTable[i].lcLocale;
                        DWORD dwBlockIndex = mpqOpenArc->lpHashTable[i].dwBlockTableIndex;
                        lpListBuffer[i].dwCompressedSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwCompressedSize;