aboutsummaryrefslogtreecommitdiff
path: root/dep/CascLib/src/CascRootFile_WoW.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2019-06-19 19:58:31 +0200
committerShauren <shauren.trinity@gmail.com>2019-06-19 19:58:31 +0200
commit658a79d94add4f9d639b959b6ac7b57a6a0a30ca (patch)
tree23ce72f38f46ad8789b8a8e9201caeae15761478 /dep/CascLib/src/CascRootFile_WoW.cpp
parentd11b9a6992b9e46cc880f4c8b085479009acfaab (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.cpp23
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);