[PATCH] crypt32: NULL ptr could leak into function (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sat Jan 31 05:54:22 CST 2009
Hi,
CID 596, a NULL pvEncoded could leak further into the
function and would then lead to crash. So just return
error if we see one.
Ciao, Marcus
---
dlls/crypt32/encode.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/encode.c b/dlls/crypt32/encode.c
index 14d193f..f562568 100644
--- a/dlls/crypt32/encode.c
+++ b/dlls/crypt32/encode.c
@@ -4458,8 +4458,13 @@ BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
}
SetLastError(NOERROR);
- if (dwFlags & CRYPT_ENCODE_ALLOC_FLAG && pvEncoded)
+ if (dwFlags & CRYPT_ENCODE_ALLOC_FLAG) {
+ if (!pvEncoded) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
*(BYTE **)pvEncoded = NULL;
+ }
encodeFunc = CRYPT_GetBuiltinEncoder(dwCertEncodingType, lpszStructType);
if (!encodeFunc)
{
--
1.5.6
More information about the wine-patches
mailing list