From: ShadowFlare Date: Wed, 16 Jan 2013 08:24:55 +0000 (-0700) Subject: Fix reusing hash table entries from deleted files when the table is full X-Git-Url: https://sfsrealm.hopto.org/projects/gitweb.cgi?p=SFmpqapi.git;a=commitdiff_plain;h=cd187faac818f58fdfa7553ee966e9201cd7768f Fix reusing hash table entries from deleted files when the table is full --- diff --git a/SFmpqapi.cpp b/SFmpqapi.cpp index 56cca21..4e87aef 100644 --- a/SFmpqapi.cpp +++ b/SFmpqapi.cpp @@ -3137,6 +3137,8 @@ MPQHANDLE GetFreeHashTableEntry(MPQHANDLE hMPQ, LPCSTR lpFileName, LCID FileLoca } i = (i + 1) % mpqOpenArc->MpqHeader.dwHashTableSize; } while (i!=dwTablePos); + if (nFirstFree != 0xFFFFFFFF) + return (MPQHANDLE)&mpqOpenArc->lpHashTable[nFirstFree]; SetLastError(MPQ_ERROR_HASH_TABLE_FULL); return 0; }