aboutsummaryrefslogtreecommitdiff
path: root/test/recursive.cnf
diff options
context:
space:
mode:
authorNeil Horman <nhorman@openssl.org>2023-11-30 14:28:09 -0500
committerNeil Horman <nhorman@openssl.org>2023-12-21 13:38:31 -0500
commit682fd21afb5428b5716e62eaefb09a7419f9cfd7 (patch)
tree71fb0a05bcde1b208ae8c47ddb2ded95e9bc284c /test/recursive.cnf
parent506ff20662a228b17840f0b49865a927a45c2908 (diff)
downloadopenssl-682fd21afb5428b5716e62eaefb09a7419f9cfd7.zip
openssl-682fd21afb5428b5716e62eaefb09a7419f9cfd7.tar.gz
openssl-682fd21afb5428b5716e62eaefb09a7419f9cfd7.tar.bz2
Detect and prevent recursive config parsing
If a malformed config file is provided such as the following: openssl_conf = openssl_init [openssl_init] providers = provider_sect [provider_sect] = provider_sect The config parsing library will crash overflowing the stack, as it recursively parses the same provider_sect ad nauseum. Prevent this by maintaing a list of visited nodes as we recurse through referenced sections, and erroring out in the event we visit any given section node more than once. Note, adding the test for this revealed that our diagnostic code inadvertently pops recorded errors off the error stack because provider_conf_load returns success even in the event that a configuration parse failed. The call path to provider_conf_load has been updated in this commit to address that shortcoming, allowing recorded errors to be visibile to calling applications. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22898)
Diffstat (limited to 'test/recursive.cnf')
-rw-r--r--test/recursive.cnf8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/recursive.cnf b/test/recursive.cnf
new file mode 100644
index 0000000..505733a
--- /dev/null
+++ b/test/recursive.cnf
@@ -0,0 +1,8 @@
+openssl_conf = openssl_init
+config_diagnostics = yes
+
+[openssl_init]
+providers = provider_sect
+
+[provider_sect]
+ = provider_sect