Juan Lang : crypt32: Fix length calculation for decoding CRL_DIST_POINT_NAME.

Alexandre Julliard julliard at winehq.org
Thu Oct 16 09:34:16 CDT 2008


Module: wine
Branch: stable
Commit: 187630cd262c6cacde80d2b3a7de494ed18912b5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=187630cd262c6cacde80d2b3a7de494ed18912b5

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Aug 15 16:19:11 2008 -0700

crypt32: Fix length calculation for decoding CRL_DIST_POINT_NAME.
(cherry picked from commit 9423f836ac76b8242a5870dbabe73b8f947252a0)

---

 dlls/crypt32/decode.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index 47b0ba6..8c16d31 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -3913,15 +3913,19 @@ static BOOL CRYPT_AsnDecodeDistPointName(const BYTE *pbEncoded,
              sizeof(CERT_ALT_NAME_ENTRY), TRUE,
              offsetof(CERT_ALT_NAME_ENTRY, u.pwszURL) };
             BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]);
+            DWORD nameLen;
 
             if (dataLen)
             {
-                DWORD nameLen;
-
                 ret = CRYPT_AsnDecodeArray(&arrayDesc,
                  pbEncoded + 1 + lenBytes, cbEncoded - 1 - lenBytes,
                  0, NULL, NULL, &nameLen, NULL, NULL);
-                bytesNeeded = sizeof(CRL_DIST_POINT_NAME) + nameLen;
+                /* The CERT_ALT_NAME_INFO's size is included by CRYPT_AsnDecodeArray
+                 * as the sizeof(struct GenericArray), so don't include it in the
+                 * total bytes needed.
+                 */
+                bytesNeeded = sizeof(CRL_DIST_POINT_NAME) + nameLen -
+                 sizeof(CERT_ALT_NAME_INFO);
             }
             else
                 bytesNeeded = sizeof(CRL_DIST_POINT_NAME);
@@ -3944,7 +3948,7 @@ static BOOL CRYPT_AsnDecodeDistPointName(const BYTE *pbEncoded,
                     name->dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
                     ret = CRYPT_AsnDecodeArray(&arrayDesc,
                      pbEncoded + 1 + lenBytes, cbEncoded - 1 - lenBytes,
-                     0, NULL, &name->u.FullName, pcbStructInfo, NULL,
+                     0, NULL, &name->u.FullName, &nameLen, NULL,
                      name->u.FullName.rgAltEntry);
                 }
                 else




More information about the wine-cvs mailing list