From c05921c4b833909cbf998787a05e15c4fb8650d4 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Mon, 16 Jan 2023 19:56:20 +0100 Subject: Add test for d2i_PKCS7 NULL dereference Reviewed-by: Shane Lontis Reviewed-by: Paul Dale --- test/recipes/25-test_pkcs7.t | 7 +++++-- test/recipes/25-test_pkcs7_data/malformed.pkcs7 | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/recipes/25-test_pkcs7_data/malformed.pkcs7 diff --git a/test/recipes/25-test_pkcs7.t b/test/recipes/25-test_pkcs7.t index 37cd43dc6b..d61cd6abad 100644 --- a/test/recipes/25-test_pkcs7.t +++ b/test/recipes/25-test_pkcs7.t @@ -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 => 3; +plan tests => 4; require_ok(srctop_file('test','recipes','tconversion.pl')); @@ -27,3 +27,6 @@ subtest 'pkcs7 conversions -- pkcs7d' => sub { tconversion( -type => 'p7d', -in => srctop_file("test", "pkcs7-1.pem"), -args => ["pkcs7"] ); }; + +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 index 0000000000..e30d1b582c --- /dev/null +++ b/test/recipes/25-test_pkcs7_data/malformed.pkcs7 @@ -0,0 +1,3 @@ +-----BEGIN PKCS7----- +MAsGCSqGSIb3DQEHAg== +-----END PKCS7----- -- cgit v1.2.3