crypt32: Fix decoding unicode names when CRYPT_DECODE_ALLOC_FLAG is not specified.

This commit is contained in:
Juan Lang 2009-11-06 17:57:40 -08:00 committed by Alexandre Julliard
parent 9495aa22bf
commit 6cefdef501
1 changed files with 22 additions and 1 deletions

View File

@ -1980,9 +1980,30 @@ static BOOL WINAPI CRYPT_AsnDecodeUnicodeName(DWORD dwCertEncodingType,
sizeof(CERT_NAME_INFO),
CRYPT_AsnDecodeUnicodeRdn, sizeof(CERT_RDN), TRUE,
offsetof(CERT_RDN, rgRDNAttr) };
DWORD bytesNeeded;
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL);
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, NULL, &bytesNeeded,
NULL);
if (ret)
{
if (!pvStructInfo)
*pcbStructInfo = bytesNeeded;
else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara,
pvStructInfo, pcbStructInfo, bytesNeeded)))
{
CERT_NAME_INFO *info;
if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
pvStructInfo = *(BYTE **)pvStructInfo;
info = pvStructInfo;
info->rgRDN = (CERT_RDN *)((BYTE *)pvStructInfo +
sizeof(CERT_NAME_INFO));
ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded,
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, pvStructInfo,
&bytesNeeded, NULL);
}
}
}
__EXCEPT_PAGE_FAULT
{