From 26f75c2d604014069b5ff32cdf7f13f9e6aec5e6 Mon Sep 17 00:00:00 2001 From: Nate Karstens Date: Fri, 20 Oct 2023 11:24:33 -0500 Subject: [PATCH] Add notes on use of strdup Added notes to OPENSSL_INIT_set_config_filename and OPENSSL_INIT_set_config_appname explaining why strdup is used instead of OPENSSL_strdup. CLA: trivial Co-authored-by: Jean Apolo Signed-off-by: Jean Apolo Signed-off-by: Nate Karstens Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21742) --- crypto/conf/conf_lib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c index 05e7bf19cc..99e9f8c987 100644 --- a/crypto/conf/conf_lib.c +++ b/crypto/conf/conf_lib.c @@ -421,6 +421,12 @@ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void) #ifndef OPENSSL_NO_STDIO +/* + * If CRYPTO_set_mem_functions is called after this, then + * memory allocation and deallocation in this function can + * become disjointed. Avoid this by always using standard + * strdup & free instead of OPENSSL_strdup & OPENSSL_free. + */ int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, const char *filename) { @@ -444,6 +450,12 @@ void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, settings->flags = flags; } +/* + * If CRYPTO_set_mem_functions is called after this, then + * memory allocation and deallocation in this function can + * become disjointed. Avoid this by always using standard + * strdup & free instead of OPENSSL_strdup & OPENSSL_free. + */ int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, const char *appname) { -- 2.34.1