Jacek Caban : crypt32: Always set returned size in CRYPT_CopySignerInfo.
Alexandre Julliard
julliard at winehq.org
Thu Feb 1 16:14:52 CST 2018
Module: wine
Branch: master
Commit: 39ba0bbe437498ee6252694f771e686e7e7b98af
URL: https://source.winehq.org/git/wine.git/?a=commit;h=39ba0bbe437498ee6252694f771e686e7e7b98af
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Feb 1 01:28:02 2018 +0100
crypt32: Always set returned size in CRYPT_CopySignerInfo.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/crypt32/msg.c | 3 +--
dlls/crypt32/tests/msg.c | 5 ++++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 80b2de7..fd43a7b 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -2727,12 +2727,10 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
size += CRYPT_SizeOfAttributes(&in->UnauthAttrs);
if (!pvData)
{
- *pcbData = size;
ret = TRUE;
}
else if (*pcbData < size)
{
- *pcbData = size;
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
@@ -2765,6 +2763,7 @@ static BOOL CRYPT_CopySignerInfo(void *pvData, DWORD *pcbData,
CRYPT_CopyAttributes(&out->UnauthAttrs, &in->UnauthAttrs, &nextData);
}
}
+ *pcbData = size;
TRACE("returning %d\n", ret);
return ret;
}
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index e9887b0..c240533 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -2857,7 +2857,7 @@ static void test_decode_msg_get_param(void)
HCRYPTPROV hCryptProv;
HCRYPTKEY key = 0;
BOOL ret;
- DWORD size = 0, value;
+ DWORD size = 0, value, req_size;
LPBYTE buf;
CMSG_CTRL_DECRYPT_PARA decryptPara = { sizeof(decryptPara), 0 };
@@ -2947,7 +2947,10 @@ static void test_decode_msg_get_param(void)
signer.SerialNumber.cbData = sizeof(serialNum);
signer.SerialNumber.pbData = serialNum;
signer.HashAlgorithm.pszObjId = oid_rsa_md5;
+ req_size = size;
+ size += 10;
CryptMsgGetParam(msg, CMSG_SIGNER_INFO_PARAM, 0, buf, &size);
+ ok(size == req_size, "size = %u, expected %u\n", size, req_size);
compare_signer_info((CMSG_SIGNER_INFO *)buf, &signer);
CryptMemFree(buf);
}
More information about the wine-cvs
mailing list