crypt32: Fix decoding unicode names when CRYPT_DECODE_ALLOC_FLAG is not specified.
This commit is contained in:
parent
9495aa22bf
commit
6cefdef501
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue