diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 80b2de78e95..fd43a7baeb3 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 e9887b06f68..c2405335b91 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); }