Juan Lang : crypt32: Fix decoding unicode names when CRYPT_DECODE_ALLOC_FLAG is not specified.
Alexandre Julliard
julliard at winehq.org
Tue Nov 10 09:39:13 CST 2009
Module: wine
Branch: master
Commit: 6cefdef5018684e7154fd9832e44fa3698fedb23
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6cefdef5018684e7154fd9832e44fa3698fedb23
Author: Juan Lang <juan.lang at gmail.com>
Date: Fri Nov 6 17:57:40 2009 -0800
crypt32: Fix decoding unicode names when CRYPT_DECODE_ALLOC_FLAG is not specified.
---
dlls/crypt32/decode.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index d6288b6..190aa27 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -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
{
More information about the wine-cvs
mailing list