Juan Lang : crypt32: Explicitly pass array pointer when decoding CRL entry extensions rather than assuming a particular alignment .
Alexandre Julliard
julliard at winehq.org
Thu Oct 15 08:54:30 CDT 2009
Module: wine
Branch: master
Commit: e0f3bf6836bf08290bc3ecb9cab349f63759e990
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e0f3bf6836bf08290bc3ecb9cab349f63759e990
Author: Juan Lang <juan.lang at gmail.com>
Date: Wed Oct 14 12:43:58 2009 -0700
crypt32: Explicitly pass array pointer when decoding CRL entry extensions rather than assuming a particular alignment.
---
dlls/crypt32/decode.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c
index c6ca92a..6b553d4 100644
--- a/dlls/crypt32/decode.c
+++ b/dlls/crypt32/decode.c
@@ -1248,6 +1248,49 @@ static BOOL WINAPI CRYPT_AsnDecodeCert(DWORD dwCertEncodingType,
return ret;
}
+static BOOL CRYPT_AsnDecodeCRLEntryExtensions(const BYTE *pbEncoded,
+ DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo,
+ DWORD *pcbDecoded)
+{
+ BOOL ret = TRUE;
+ struct AsnArrayDescriptor arrayDesc = { ASN_SEQUENCEOF,
+ CRYPT_AsnDecodeExtension, sizeof(CERT_EXTENSION), TRUE,
+ offsetof(CERT_EXTENSION, pszObjId) };
+ DWORD itemSize;
+
+ TRACE("%p, %d, %08x, %p, %d, %p\n", pbEncoded, cbEncoded, dwFlags,
+ pvStructInfo, *pcbStructInfo, pcbDecoded);
+
+ ret = CRYPT_AsnDecodeArrayNoAlloc(&arrayDesc, pbEncoded, cbEncoded,
+ NULL, NULL, &itemSize, pcbDecoded);
+ if (ret)
+ {
+ DWORD bytesNeeded;
+
+ /* The size expected by the caller includes the combination of
+ * CRL_ENTRY's cExtension and rgExtension, in addition to the size of
+ * all the decoded items. CRYPT_AsnDecodeArrayNoAlloc only returns
+ * the size of the decoded items, so add the size of cExtension and
+ * rgExtension.
+ */
+ bytesNeeded = FINALMEMBERSIZE(CRL_ENTRY, cExtension) + itemSize;
+ if (!pvStructInfo)
+ *pcbStructInfo = bytesNeeded;
+ else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, NULL, pvStructInfo,
+ pcbStructInfo, bytesNeeded)))
+ {
+ CRL_ENTRY *entry;
+
+ entry = (CRL_ENTRY *)((BYTE *)pvStructInfo -
+ offsetof(CRL_ENTRY, cExtension));
+ ret = CRYPT_AsnDecodeArrayNoAlloc(&arrayDesc, pbEncoded,
+ cbEncoded, &entry->cExtension, entry->rgExtension, &itemSize,
+ pcbDecoded);
+ }
+ }
+ return ret;
+}
+
static BOOL CRYPT_AsnDecodeCRLEntry(const BYTE *pbEncoded, DWORD cbEncoded,
DWORD dwFlags, void *pvStructInfo, DWORD *pcbStructInfo, DWORD *pcbDecoded)
{
@@ -1259,7 +1302,8 @@ static BOOL CRYPT_AsnDecodeCRLEntry(const BYTE *pbEncoded, DWORD cbEncoded,
{ 0, offsetof(CRL_ENTRY, RevocationDate),
CRYPT_AsnDecodeChoiceOfTimeInternal, sizeof(FILETIME), FALSE, FALSE, 0 },
{ ASN_SEQUENCEOF, offsetof(CRL_ENTRY, cExtension),
- CRYPT_AsnDecodeExtensionsInternal, sizeof(CERT_EXTENSIONS), TRUE, TRUE,
+ CRYPT_AsnDecodeCRLEntryExtensions,
+ FINALMEMBERSIZE(CRL_ENTRY, cExtension), TRUE, TRUE,
offsetof(CRL_ENTRY, rgExtension), 0 },
};
PCRL_ENTRY entry = pvStructInfo;
More information about the wine-cvs
mailing list