crypt32: Check number of bytes returned by ReadFile and avoid a memory leak on error path.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Oct 29 02:08:59 CDT 2013
---
dlls/crypt32/filestore.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/crypt32/filestore.c b/dlls/crypt32/filestore.c
index 44b9bbb..81c8c5e 100644
--- a/dlls/crypt32/filestore.c
+++ b/dlls/crypt32/filestore.c
@@ -119,7 +119,8 @@ static BOOL CRYPT_ReadBlobFromFile(HANDLE file, 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);
}
}
return ret;
--
1.8.4.1
More information about the wine-patches
mailing list