From 63c44d4282ecdbb233bf3c26463336d08ca04ea3 Mon Sep 17 00:00:00 2001
From: Zhipeng Zhao <zhaozhipeng@uniontech.com>
Date: Thu, 2 Jul 2020 13:47:26 +0800
Subject: [PATCH] crypt32: Add parameter validation.
Signed-off-by: Zhipeng Zhao <zhaozhipeng@uniontech.com>
---
dlls/crypt32/msg.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index f591a5e72e..42cb9d0e31 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -3660,6 +3660,12 @@ BOOL WINAPI CryptMsgClose(HCRYPTMSG hCryptMsg)
BOOL WINAPI CryptMsgUpdate(HCRYPTMSG hCryptMsg, const BYTE *pbData,
DWORD cbData, BOOL fFinal)
{
+ if (!hCryptMsg)
+ {
+ SetLastError(E_INVALIDARG);
+ return FALSE;
+ }
+
CryptMsgBase *msg = hCryptMsg;
This makes the msg declaration
TRACE("(%p, %p, %d, %d)\n", hCryptMsg, pbData, cbData, fFinal);
@@ -3670,6 +3676,12 @@ BOOL WINAPI CryptMsgUpdate(HCRYPTMSG hCryptMsg, const BYTE *pbData,
BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
DWORD dwIndex, void *pvData, DWORD *pcbData)
{
+ if (!hCryptMsg)
+ {
+ SetLastError(E_INVALIDARG);
+ return FALSE;
+ }
+
CryptMsgBase *msg = hCryptMsg;
TRACE("(%p, %d, %d, %p, %p)\n", hCryptMsg, dwParamType, dwIndex,
@@ -3680,6 +3692,12 @@ BOOL WINAPI CryptMsgGetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
BOOL WINAPI CryptMsgControl(HCRYPTMSG hCryptMsg, DWORD dwFlags,
DWORD dwCtrlType, const void *pvCtrlPara)
{
+ if (!hCryptMsg)
+ {
+ SetLastError(E_INVALIDARG);
+ return FALSE;
+ }
+
CryptMsgBase *msg = hCryptMsg;
TRACE("(%p, %08x, %d, %p)\n", hCryptMsg, dwFlags, dwCtrlType,