Juan Lang : crypt32: Decode authority info access with CRYPT_AsnDecodeArrayNoAlloc.

Alexandre Julliard julliard at winehq.org
Thu Oct 15 08:54:37 CDT 2009


Module: wine
Branch: master
Commit: bba695cc3fb60134e1820420ec2950efbd567701
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bba695cc3fb60134e1820420ec2950efbd567701

Author: Juan Lang <juan.lang at gmail.com>
Date:   Wed Oct 14 13:05:13 2009 -0700

crypt32: Decode authority info access with CRYPT_AsnDecodeArrayNoAlloc.

---

 dlls/crypt32/decode.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index e19984e..19ad2ec 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -3458,9 +3458,29 @@ static BOOL WINAPI CRYPT_AsnDecodeAuthorityInfoAccess(DWORD dwCertEncodingType,
          sizeof(CERT_AUTHORITY_INFO_ACCESS),
          CRYPT_AsnDecodeAccessDescription, sizeof(CERT_ACCESS_DESCRIPTION),
          TRUE, offsetof(CERT_ACCESS_DESCRIPTION, pszAccessMethod) };
+        DWORD bytesNeeded;
 
-        ret = CRYPT_AsnDecodeArray(&arrayDesc, pbEncoded, cbEncoded, dwFlags,
-         pDecodePara, pvStructInfo, pcbStructInfo, NULL, NULL);
+        ret = CRYPT_AsnDecodeArrayNoAlloc(&arrayDesc, pbEncoded, cbEncoded,
+         dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, &bytesNeeded, NULL);
+        if (ret)
+        {
+            if (!pvStructInfo)
+                *pcbStructInfo = bytesNeeded;
+            else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara,
+             pvStructInfo, pcbStructInfo, bytesNeeded)))
+            {
+                CERT_AUTHORITY_INFO_ACCESS *access;
+
+                if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
+                    pvStructInfo = *(BYTE **)pvStructInfo;
+                access = pvStructInfo;
+                access->rgAccDescr = (PCERT_ACCESS_DESCRIPTION)
+                 ((BYTE *)pvStructInfo + sizeof(CERT_AUTHORITY_INFO_ACCESS));
+                ret = CRYPT_AsnDecodeArrayNoAlloc(&arrayDesc,
+                 pbEncoded, cbEncoded, dwFlags & ~CRYPT_DECODE_ALLOC_FLAG,
+                 &access->cAccDescr, pcbStructInfo, NULL);
+            }
+        }
     }
     __EXCEPT_PAGE_FAULT
     {




More information about the wine-cvs mailing list