crypt32: Use decode function's returned decoded length to advance pointer when decoding an array.
This commit is contained in:
parent
ee28204fcf
commit
0bd29b1243
@ -709,6 +709,8 @@ static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc,
|
|||||||
i < cItems && ptr - pbEncoded - 1 - lenBytes <
|
i < cItems && ptr - pbEncoded - 1 - lenBytes <
|
||||||
dataLen; i++)
|
dataLen; i++)
|
||||||
{
|
{
|
||||||
|
DWORD itemDecoded;
|
||||||
|
|
||||||
if (arrayDesc->hasPointer)
|
if (arrayDesc->hasPointer)
|
||||||
*(BYTE **)(array->rgItems + i * arrayDesc->itemSize
|
*(BYTE **)(array->rgItems + i * arrayDesc->itemSize
|
||||||
+ arrayDesc->pointerOffset) = nextData;
|
+ arrayDesc->pointerOffset) = nextData;
|
||||||
@ -716,16 +718,11 @@ static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc,
|
|||||||
itemSizes[i].encodedLen,
|
itemSizes[i].encodedLen,
|
||||||
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG,
|
dwFlags & ~CRYPT_DECODE_ALLOC_FLAG,
|
||||||
array->rgItems + i * arrayDesc->itemSize,
|
array->rgItems + i * arrayDesc->itemSize,
|
||||||
&itemSizes[i].size, NULL);
|
&itemSizes[i].size, &itemDecoded);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
DWORD nextLen;
|
|
||||||
|
|
||||||
nextData += itemSizes[i].size - arrayDesc->itemSize;
|
nextData += itemSizes[i].size - arrayDesc->itemSize;
|
||||||
ret = CRYPT_GetLen(ptr,
|
ptr += itemDecoded;
|
||||||
cbEncoded - (ptr - pbEncoded), &nextLen);
|
|
||||||
if (ret)
|
|
||||||
ptr += nextLen + 1 + GET_LEN_BYTES(ptr[1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user