From 658a79d94add4f9d639b959b6ac7b57a6a0a30ca Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 19 Jun 2019 19:58:31 +0200 Subject: Dep/CascLib: Update to ladislav-zezula/CascLib@c588b7bf538a010fd3376c90bd3a59f2142f05be --- dep/CascLib/src/CascRootFile_WoW.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'dep/CascLib/src/CascRootFile_WoW.cpp') 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); -- cgit v1.2.3