summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2019-01-29 14:16:28 +0100
committerBernd Edlinger <bernd.edlinger@hotmail.de>2019-01-31 19:14:17 +0100
commit7193394aeea6422694bff5bb0c4f9e101f5ce44f (patch)
tree5c6842b4bba993986ce1fb2baecaaa8367cbd554 /test
parent822e6d95e063a8fb6cd6b8e272dc5d9338c72601 (diff)
Fix a memory leak with di2_X509_CRL reuse
Additionally avoid undefined behavior with in-place memcpy in X509_CRL_digest. Fixes #8099 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8112) (cherry picked from commit a727627922b8a9ec6628ffaa2054b4b3833d674b)
Diffstat (limited to 'test')
-rw-r--r--test/crltest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/crltest.c b/test/crltest.c
index 4d35fd4081..6ce9890260 100644
--- a/test/crltest.c
+++ b/test/crltest.c
@@ -357,6 +357,20 @@ static int test_unknown_critical_crl(int n)
return r;
}
+static int test_reuse_crl(void)
+{
+ X509_CRL *reused_crl = CRL_from_strings(kBasicCRL);
+ char *p;
+ BIO *b = glue2bio(kRevokedCRL, &p);
+
+ reused_crl = PEM_read_bio_X509_CRL(b, &reused_crl, NULL, NULL);
+
+ OPENSSL_free(p);
+ BIO_free(b);
+ X509_CRL_free(reused_crl);
+ return 1;
+}
+
int setup_tests(void)
{
if (!TEST_ptr(test_root = X509_from_strings(kCRLTestRoot))
@@ -368,6 +382,7 @@ int setup_tests(void)
ADD_TEST(test_bad_issuer_crl);
ADD_TEST(test_known_critical_crl);
ADD_ALL_TESTS(test_unknown_critical_crl, OSSL_NELEM(unknown_critical_crls));
+ ADD_TEST(test_reuse_crl);
return 1;
}