Juan Lang : crypt32: Decode CRL dist points using CRYPT_AsnDecodeArrayNoAlloc.

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


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

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

crypt32: Decode CRL dist points using 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 4c21549..54fc790 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -5079,9 +5079,29 @@ static BOOL WINAPI CRYPT_AsnDecodeCRLDistPoints(DWORD dwCertEncodingType,
          sizeof(CRL_DIST_POINTS_INFO),
          CRYPT_AsnDecodeDistPoint, sizeof(CRL_DIST_POINT), TRUE,
          offsetof(CRL_DIST_POINT, DistPointName.u.FullName.rgAltEntry) };
+        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)))
+            {
+                CRL_DIST_POINTS_INFO *info;
+
+                if (dwFlags & CRYPT_DECODE_ALLOC_FLAG)
+                    pvStructInfo = *(BYTE **)pvStructInfo;
+                info = pvStructInfo;
+                info->rgDistPoint = (PCRL_DIST_POINT)
+                 ((BYTE *)pvStructInfo + sizeof(CRL_DIST_POINTS_INFO));
+                ret = CRYPT_AsnDecodeArrayNoAlloc(&arrayDesc,
+                 pbEncoded, cbEncoded, dwFlags & ~CRYPT_DECODE_ALLOC_FLAG,
+                 &info->cDistPoint, pcbStructInfo, NULL);
+            }
+        }
     }
     __EXCEPT_PAGE_FAULT
     {




More information about the wine-cvs mailing list