crypt32: Be more strict about format of serialized store files.

This commit is contained in:
Juan Lang 2007-09-28 09:06:11 -07:00 committed by Alexandre Julliard
parent 15cab33041
commit 661525c606
1 changed files with 7 additions and 1 deletions

View File

@ -431,7 +431,11 @@ BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store)
ret = ReadFile(file, fileHeaderBuf, sizeof(fileHeaderBuf), &read, NULL);
if (ret)
{
if (!memcmp(fileHeaderBuf, fileHeader, read))
if (!read)
; /* an empty file is okay */
else if (read != sizeof(fileHeaderBuf))
ret = FALSE;
else if (!memcmp(fileHeaderBuf, fileHeader, read))
{
WINE_CERT_PROP_HEADER propHdr;
const void *context = NULL;
@ -503,6 +507,8 @@ BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store)
CryptMemFree(buf);
ret = TRUE;
}
else
ret = FALSE;
}
else
ret = TRUE;