[PATCH] crypt32: Handle NULL ptr leak in CryptDecodeObjectEx (Coverity)
Marcus Meissner
marcus at jet.franken.de
Fri Dec 31 05:50:36 CST 2010
Hi,
(another queue cleanup)
CID 595, a NULL pvStructInfo could later be unsafely dereferenced
in the function. Avoid it.
Ciao, Marcus
---
dlls/crypt32/decode.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index a1431fb..c02147f 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -5976,8 +5976,13 @@ BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType,
}
SetLastError(NOERROR);
- if (dwFlags & CRYPT_DECODE_ALLOC_FLAG && pvStructInfo)
+ if (dwFlags & CRYPT_DECODE_ALLOC_FLAG) {
+ if (!pvStructInfo) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
*(BYTE **)pvStructInfo = NULL;
+ }
decodeFunc = CRYPT_GetBuiltinDecoder(dwCertEncodingType, lpszStructType);
if (!decodeFunc)
{
--
1.7.1
More information about the wine-patches
mailing list