crypt32: Pass length rather than entire message to CRYPT_EncodeContentLength.

This commit is contained in:
Juan Lang 2007-09-18 09:20:17 -07:00 committed by Alexandre Julliard
parent 145d56847b
commit 19956d6e97
1 changed files with 6 additions and 6 deletions

View File

@ -113,7 +113,7 @@ static WINAPI BOOL CRYPT_EncodeContentLength(DWORD dwCertEncodingType,
LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags,
PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded)
{
const CDataEncodeMsg *msg = (const CDataEncodeMsg *)pvStructInfo;
DWORD dataLen = *(DWORD *)pvStructInfo;
DWORD lenBytes;
BOOL ret = TRUE;
@ -121,9 +121,9 @@ static WINAPI BOOL CRYPT_EncodeContentLength(DWORD dwCertEncodingType,
* the message isn't available yet. The caller will use the length
* reported here to encode its length.
*/
CRYPT_EncodeLen(msg->base.stream_info.cbContent, NULL, &lenBytes);
CRYPT_EncodeLen(dataLen, NULL, &lenBytes);
if (!pbEncoded)
*pcbEncoded = 1 + lenBytes + msg->base.stream_info.cbContent;
*pcbEncoded = 1 + lenBytes + dataLen;
else
{
if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, pbEncoded,
@ -132,7 +132,7 @@ static WINAPI BOOL CRYPT_EncodeContentLength(DWORD dwCertEncodingType,
if (dwFlags & CRYPT_ENCODE_ALLOC_FLAG)
pbEncoded = *(BYTE **)pbEncoded;
*pbEncoded++ = ASN_OCTETSTRING;
CRYPT_EncodeLen(msg->base.stream_info.cbContent, pbEncoded,
CRYPT_EncodeLen(dataLen, pbEncoded,
&lenBytes);
}
}
@ -153,8 +153,8 @@ static BOOL CRYPT_EncodeDataContentInfoHeader(CDataEncodeMsg *msg,
}
else
{
struct AsnConstructedItem constructed = { 0, msg,
CRYPT_EncodeContentLength };
struct AsnConstructedItem constructed = { 0,
&msg->base.stream_info.cbContent, CRYPT_EncodeContentLength };
struct AsnEncodeSequenceItem items[2] = {
{ szOID_RSA_data, CRYPT_AsnEncodeOid, 0 },
{ &constructed, CRYPT_AsnEncodeConstructed, 0 },