]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add test for d2i_PKCS7 NULL dereference
authorTomas Mraz <tomas@openssl.org>
Mon, 16 Jan 2023 18:56:20 +0000 (19:56 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 7 Feb 2023 16:05:10 +0000 (17:05 +0100)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
test/recipes/25-test_pkcs7.t
test/recipes/25-test_pkcs7_data/malformed.pkcs7 [new file with mode: 0644]

index 1af952a45dc533634c21c7170e63e1fa40e336a0..cdbcf3869c84d1442540d977a34a9d6afb8278bd 100644 (file)
@@ -11,11 +11,11 @@ use strict;
 use warnings;
 
 use File::Spec;
-use OpenSSL::Test qw/:DEFAULT srctop_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file data_file/;
 
 setup("test_pkcs7");
 
-plan tests => 6;
+plan tests => 7;
 
 require_ok(srctop_file('test','recipes','tconversion.pl'));
 
@@ -38,5 +38,8 @@ ok(run(app(["openssl", "crl2pkcs7", "-nocrl",
 ok(run(app(["openssl", "pkcs7", "-print_certs", "-quiet",
             "-in", $p7file,
             "-out", $out])));
-is(cmp_text($out, srctop_file('test', 'recipes', '25-test_pkcs7_data', 'grfc.out')),
-    0, 'Comparing output');
\ No newline at end of file
+is(cmp_text($out, data_file('grfc.out')),
+    0, 'Comparing output');
+
+my $malformed = data_file('malformed.pkcs7');
+ok(run(app(["openssl", "pkcs7", "-in", $malformed])));
diff --git a/test/recipes/25-test_pkcs7_data/malformed.pkcs7 b/test/recipes/25-test_pkcs7_data/malformed.pkcs7
new file mode 100644 (file)
index 0000000..e30d1b5
--- /dev/null
@@ -0,0 +1,3 @@
+-----BEGIN PKCS7-----
+MAsGCSqGSIb3DQEHAg==
+-----END PKCS7-----