Fix NULL pointer deref when parsing the stable section
authorNeil Horman <nhorman@openssl.org>
Thu, 7 Dec 2023 21:56:39 +0000 (16:56 -0500)
committerTomas Mraz <tomas@openssl.org>
Fri, 12 Jan 2024 09:37:22 +0000 (10:37 +0100)
commit0981c20f8efa68bf9d68d7715280f83812c19a7e
tree4da3299f29238595d3f90c17d992fd9743abda5b
parent3cb1b51dddf4deaf5e3886b827f3245d81670bc7
Fix NULL pointer deref when parsing the stable section

When parsing the stable section of a config such as this:
openssl_conf = openssl_init
[openssl_init]
stbl_section = mstbl
[mstbl]
id-tc26 = min

Can lead to a SIGSEGV, as the parsing code doesnt recognize min as a
proper section name without a trailing colon to associate it with a
value.  As a result the stack of configuration values has an entry with
a null value in it, which leads to the SIGSEGV in do_tcreate when we
attempt to pass NULL to strtoul.

Fix it by skipping any entry in the config name/value list that has a
null value, prior to passing it to stroul

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22988)
crypto/asn1/asn_mstbl.c
test/asn1_stable_parse_test.c [new file with mode: 0644]
test/build.info
test/recipes/04-test_asn1_stable_parse.t [new file with mode: 0644]
test/recipes/04-test_asn1_stable_parse_data/asn1_stable_parse.cnf [new file with mode: 0644]