Juan Lang : crypt32: Use decode function' s returned decoded length to advance pointer when decoding an array.

Alexandre Julliard julliard at winehq.org
Tue Sep 18 05:31:35 CDT 2007


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Mon Sep 17 18:02:26 2007 -0700

crypt32: Use decode function's returned decoded length to advance pointer when decoding an array.

---

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

diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index caf34cb..082c28a 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -709,6 +709,8 @@ static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc,
                      i < cItems && ptr - pbEncoded - 1 - lenBytes <
                      dataLen; i++)
                     {
+                        DWORD itemDecoded;
+
                         if (arrayDesc->hasPointer)
                             *(BYTE **)(array->rgItems + i * arrayDesc->itemSize
                              + arrayDesc->pointerOffset) = nextData;
@@ -716,16 +718,11 @@ static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc,
                          itemSizes[i].encodedLen,
                          dwFlags & ~CRYPT_DECODE_ALLOC_FLAG,
                          array->rgItems + i * arrayDesc->itemSize,
-                         &itemSizes[i].size, NULL);
+                         &itemSizes[i].size, &itemDecoded);
                         if (ret)
                         {
-                            DWORD nextLen;
-
                             nextData += itemSizes[i].size - arrayDesc->itemSize;
-                            ret = CRYPT_GetLen(ptr,
-                             cbEncoded - (ptr - pbEncoded), &nextLen);
-                            if (ret)
-                                ptr += nextLen + 1 + GET_LEN_BYTES(ptr[1]);
+                            ptr += itemDecoded;
                         }
                     }
                 }




More information about the wine-cvs mailing list