[rs-commit] r93 - /redwax-tool/trunk/redwax_p11kit.c

rs-commit at redwax.eu rs-commit at redwax.eu
Sun Nov 28 20:06:03 CET 2021


Author: minfrin at redwax.eu
Date: Sun Nov 28 20:06:02 2021
New Revision: 93

Log:
Protect against missing vvalues.

Modified:
    redwax-tool/trunk/redwax_p11kit.c

Modified: redwax-tool/trunk/redwax_p11kit.c
==============================================================================
--- redwax-tool/trunk/redwax_p11kit.c	(original)
+++ redwax-tool/trunk/redwax_p11kit.c	Sun Nov 28 20:06:02 2021
@@ -1386,14 +1386,17 @@
                 if (ret == CKR_OK || ret == CKR_ATTRIBUTE_SENSITIVE
                         || ret == CKR_ATTRIBUTE_TYPE_INVALID) {
 
-                    CK_BBOOL trusted = *(CK_BBOOL *)cert_template[1].pValue;
+                    CK_BBOOL trusted =
+                            (sizeof(CK_BBOOL) == cert_template[1].ulValueLen) ?
+                                    *(CK_BBOOL*) cert_template[1].pValue : 0;
 
                     cert->common.type = REDWAX_CERTIFICATE_X509;
 
-                    cert->der = apr_pmemdup(cert->pool,
-                            cert_template[0].pValue,
-                            cert_template[0].ulValueLen);
-                    cert->len = cert_template[0].ulValueLen;
+                    if (CK_UNAVAILABLE_INFORMATION
+                            != cert_template[0].ulValueLen) {
+                        cert->der = cert_template[0].pValue;
+                        cert->len = cert_template[0].ulValueLen;
+                    }
 
                     rt_run_normalise_certificate(r, cert, 1);
 



More information about the rs-commit mailing list