diff options
author | Ladislav Zezula <zezula@volny.cz> | 2023-12-21 22:35:08 +0100 |
---|---|---|
committer | Ladislav Zezula <zezula@volny.cz> | 2023-12-21 22:35:08 +0100 |
commit | 47e5e0aced099800cb93a8441d3d5ab33240d23e (patch) | |
tree | dac3489834048ad9d84958f3734705b2db41d711 /src/SFileGetFileInfo.cpp | |
parent | 5d938c500a6c37b97c80d7cb3f7435114090e291 (diff) |
Fixed https://github.com/ladislav-zezula/StormLib/issues/311
Diffstat (limited to 'src/SFileGetFileInfo.cpp')
-rw-r--r-- | src/SFileGetFileInfo.cpp | 14 |
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);
|