crypt32: Check number of bytes returned by ReadFile and avoid a memory leak on error path.
This commit is contained in:
parent
d95797e170
commit
99a81e1843
|
@ -52,7 +52,8 @@ static BOOL CRYPT_ReadBlobFromFile(LPCWSTR fileName, PCERT_BLOB blob)
|
|||
{
|
||||
DWORD read;
|
||||
|
||||
ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL);
|
||||
ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL) && read == blob->cbData;
|
||||
if (!ret) CryptMemFree(blob->pbData);
|
||||
}
|
||||
}
|
||||
CloseHandle(file);
|
||||
|
|
Loading…
Reference in New Issue