diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2023-12-10 10:18:19 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-12-12 13:43:08 +0100 |
commit | 1c078212f1548d7f647a1f0f12ed6df257c85cc3 (patch) | |
tree | 4648ee1bee1290c8a3813ca1389e7fb6e5804ca0 /test/recipes | |
parent | 6ebdbba76a45294e22006ede1442847cdee24f03 (diff) | |
download | openssl-1c078212f1548d7f647a1f0f12ed6df257c85cc3.tar.gz |
Fix a possible memory leak in do_othername
Since the gen->type will not be set in a2i_GENERAL_NAME
the gen->d.otherName will not be automatically
cleaned up by GENERAL_NAME_free.
Also fixed a similar leak in a2i_GENERAL_NAME,
where ASN1_STRING_set may fail but gen->d.ia5
will not be automatically cleaned up.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22996)
Diffstat (limited to 'test/recipes')
-rw-r--r-- | test/recipes/25-test_req.t | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/recipes/25-test_req.t b/test/recipes/25-test_req.t index 32dc4ded8c..20e338b46f 100644 --- a/test/recipes/25-test_req.t +++ b/test/recipes/25-test_req.t @@ -15,7 +15,7 @@ use OpenSSL::Test qw/:DEFAULT srctop_file/; setup("test_req"); -plan tests => 104; +plan tests => 106; require_ok(srctop_file('test', 'recipes', 'tconversion.pl')); @@ -40,10 +40,14 @@ my @addext_args = ( "openssl", "req", "-new", "-out", "testreq.pem", "-key", srctop_file(@certs, "ee-key.pem"), "-config", srctop_file("test", "test.cnf"), @req_new ); my $val = "subjectAltName=DNS:example.com"; +my $val1 = "subjectAltName=otherName:1.2.3.4;UTF8:test,email:info\@example.com"; my $val2 = " " . $val; my $val3 = $val; $val3 =~ s/=/ =/; ok( run(app([@addext_args, "-addext", $val]))); +ok( run(app([@addext_args, "-addext", $val1]))); +$val1 =~ s/UTF8/XXXX/; # execute the error handling in do_othername +ok(!run(app([@addext_args, "-addext", $val1]))); ok(!run(app([@addext_args, "-addext", $val, "-addext", $val]))); ok(!run(app([@addext_args, "-addext", $val, "-addext", $val2]))); ok(!run(app([@addext_args, "-addext", $val, "-addext", $val3]))); |