mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-27 13:33:29 +01:00
Static Code Analysis : Avoid using invalidate integer value received from GetFileSize.
This commit is contained in:
parent
9d027b02b9
commit
7bb812af66
@ -7420,11 +7420,15 @@ BOOL LoadInt16 (char *filePath, int *result, __int64 fileOffset)
|
||||
char *LoadFile (const char *fileName, DWORD *size)
|
||||
{
|
||||
char *buf;
|
||||
DWORD fileSize = INVALID_FILE_SIZE;
|
||||
HANDLE h = CreateFile (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
|
||||
*size = GetFileSize (h, NULL);
|
||||
if ((fileSize = GetFileSize (h, NULL)) == INVALID_FILE_SIZE)
|
||||
return NULL;
|
||||
|
||||
*size = fileSize;
|
||||
buf = (char *) calloc (*size + 1, 1);
|
||||
|
||||
if (buf == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user