crypt32: Always set returned size in CRYPT_CopySignerInfo.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-02-01 01:28:02 +01:00 committed by Alexandre Julliard
parent 2a2ecdd564
commit 39ba0bbe43
2 changed files with 5 additions and 3 deletions

View File

@ -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;
}

View File

@ -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);
}