aboutsummaryrefslogtreecommitdiff
path: root/src/SFileGetFileInfo.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2023-12-21 22:37:46 +0100
committerGitHub <noreply@github.com>2023-12-21 22:37:46 +0100
commit61b6665433e8de0e4be68e69ddfb0128421d4057 (patch)
treedba51804af1606b558d4e2eb74b7428f6171e932 /src/SFileGetFileInfo.cpp
parentaaa011852dcbbf92cc2475720291198d6f5597ca (diff)
parent2b50c079cb28d5becb347c54777edca6c9771ea3 (diff)
Merge pull request #313 from ladislav-zezula/LZ_TabsToSpaces
Fixed https://github.com/ladislav-zezula/StormLib/issues/311
Diffstat (limited to 'src/SFileGetFileInfo.cpp')
-rw-r--r--src/SFileGetFileInfo.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/SFileGetFileInfo.cpp b/src/SFileGetFileInfo.cpp
index 7a8afe0..20f5e75 100644
--- a/src/SFileGetFileInfo.cpp
+++ b/src/SFileGetFileInfo.cpp
@@ -68,6 +68,10 @@ static bool GetInfo_BufferCheck(void * pvFileInfo, DWORD cbFileInfo, DWORD cbDat
static bool GetInfo(void * pvFileInfo, DWORD cbFileInfo, const void * pvData, DWORD cbData, LPDWORD pcbLengthNeeded)
{
+ // Verify the input parameter
+ if(pvData == NULL)
+ return GetInfo_ReturnError(ERROR_INVALID_PARAMETER);
+
// Verify buffer pointer and buffer size
if(!GetInfo_BufferCheck(pvFileInfo, cbFileInfo, cbData, pcbLengthNeeded))
return false;
@@ -81,6 +85,10 @@ static bool GetInfo_Allocated(void * pvFileInfo, DWORD cbFileInfo, void * pvData
{
bool bResult;
+ // Verify the input parameter
+ if(pvData == NULL)
+ return GetInfo_ReturnError(ERROR_INVALID_PARAMETER);
+
// Verify buffer pointer and buffer size
if((bResult = GetInfo_BufferCheck(pvFileInfo, cbFileInfo, cbData, pcbLengthNeeded)) != false)
memcpy(pvFileInfo, pvData, cbData);
@@ -401,15 +409,21 @@ bool WINAPI SFileGetFileInfo(
return GetInfo(pvFileInfo, cbFileInfo, &hf->dwHashIndex, sizeof(DWORD), pcbLengthNeeded);
case SFileInfoNameHash1:
+ if(hf->pHashEntry == NULL)
+ return GetInfo_ReturnError(ERROR_INVALID_PARAMETER);
return GetInfo(pvFileInfo, cbFileInfo, &hf->pHashEntry->dwName1, sizeof(DWORD), pcbLengthNeeded);
case SFileInfoNameHash2:
+ if(hf->pHashEntry == NULL)
+ return GetInfo_ReturnError(ERROR_INVALID_PARAMETER);
return GetInfo(pvFileInfo, cbFileInfo, &hf->pHashEntry->dwName2, sizeof(DWORD), pcbLengthNeeded);
case SFileInfoNameHash3:
return GetInfo(pvFileInfo, cbFileInfo, &pFileEntry->FileNameHash, sizeof(ULONGLONG), pcbLengthNeeded);
case SFileInfoLocale:
+ if(hf->pHashEntry == NULL)
+ return GetInfo_ReturnError(ERROR_INVALID_PARAMETER);
dwInt32Value = SFILE_MAKE_LCID(hf->pHashEntry->Locale, hf->pHashEntry->Platform);
return GetInfo(pvFileInfo, cbFileInfo, &dwInt32Value, sizeof(DWORD), pcbLengthNeeded);