diff options
author | Shauren <shauren.trinity@gmail.com> | 2019-06-19 19:58:31 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-06-19 19:58:31 +0200 |
commit | 658a79d94add4f9d639b959b6ac7b57a6a0a30ca (patch) | |
tree | 23ce72f38f46ad8789b8a8e9201caeae15761478 /dep/CascLib/src/CascRootFile_WoW.cpp | |
parent | d11b9a6992b9e46cc880f4c8b085479009acfaab (diff) |
Dep/CascLib: Update to ladislav-zezula/CascLib@c588b7bf538a010fd3376c90bd3a59f2142f05be
Diffstat (limited to 'dep/CascLib/src/CascRootFile_WoW.cpp')
-rw-r--r-- | dep/CascLib/src/CascRootFile_WoW.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/dep/CascLib/src/CascRootFile_WoW.cpp b/dep/CascLib/src/CascRootFile_WoW.cpp index 780220bbe40..766e226a2b1 100644 --- a/dep/CascLib/src/CascRootFile_WoW.cpp +++ b/dep/CascLib/src/CascRootFile_WoW.cpp @@ -395,14 +395,24 @@ struct TRootHandler_WoW : public TFileTreeRoot { PCASC_FILE_NODE pFileNode; ULONGLONG FileNameHash; + size_t nLength; DWORD FileDataId = CASC_INVALID_ID; char szFileName[MAX_PATH]; if(RootFormat == RootFormatWoW82) { // Keep going through the listfile - while(ListFile_GetNext(pSearch->pCache, szFileName, _countof(szFileName), &FileDataId)) + for(;;) { + // Retrieve the next line from the list file. Ignore lines that are too long to fit in the buffer + nLength = ListFile_GetNext(pSearch->pCache, szFileName, _countof(szFileName), &FileDataId); + if(nLength == 0) + { + if(GetLastError() == ERROR_INSUFFICIENT_BUFFER) + continue; + break; + } + // Try to find the file node by file data id pFileNode = FileTree.FindById(FileDataId); if(pFileNode != NULL && pFileNode->NameLength == 0) @@ -414,8 +424,17 @@ struct TRootHandler_WoW : public TFileTreeRoot else { // Keep going through the listfile - while(ListFile_GetNextLine(pSearch->pCache, szFileName, MAX_PATH)) + for(;;) { + // Retrieve the next line from the list file. Ignore lines that are too long to fit in the buffer + nLength = ListFile_GetNextLine(pSearch->pCache, szFileName, _countof(szFileName)); + if(nLength == 0) + { + if(GetLastError() == ERROR_INSUFFICIENT_BUFFER) + continue; + break; + } + // Calculate the hash of the file name FileNameHash = CalcFileNameHash(szFileName); |