From: sashan Date: Wed, 26 Mar 2025 08:37:01 +0000 (+0100) Subject: Use OPENSSL_strdup() for strings freed by OPENSSL_free() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7fa51041e4d68838b2c7ddf4f77d6bba0edf2735;p=thirdparty%2Fopenssl.git Use OPENSSL_strdup() for strings freed by OPENSSL_free() Things can get messy when application decides to use it's own memory allocation functions using CRYPTO_set_mem_functions(3ossl) Reviewed-by: Richard Levitte Reviewed-by: Matt Caswell Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27163) --- diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 6b9ae7c0652..9233322b5ff 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -127,7 +127,7 @@ static int set_random_provider_name(RAND_GLOBAL *dgbl, const char *name) return 1; OPENSSL_free(dgbl->random_provider_name); - dgbl->random_provider_name = strdup(name); + dgbl->random_provider_name = OPENSSL_strdup(name); return dgbl->random_provider_name != NULL; } diff --git a/test/conf_include_test.c b/test/conf_include_test.c index 2b16c6ebe49..851af5614bb 100644 --- a/test/conf_include_test.c +++ b/test/conf_include_test.c @@ -59,7 +59,7 @@ static char *change_path(const char *file) ret = chdir(s); if (ret == 0) - new_config_name = strdup(last + DIRSEP_PRESERVE + 1); + new_config_name = OPENSSL_strdup(last + DIRSEP_PRESERVE + 1); err: OPENSSL_free(s); return new_config_name;