Skip to content

Commit

Permalink
Add notes on use of strdup
Browse files Browse the repository at this point in the history
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 <jean.apolo@garmin.com>
Signed-off-by: Jean Apolo <jean.apolo@garmin.com>
Signed-off-by: Nate Karstens <nate.karstens@garmin.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #21742)
  • Loading branch information
nkarstens authored and mattcaswell committed Oct 24, 2023
1 parent a2fe10c commit 26f75c2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crypto/conf/conf_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down

0 comments on commit 26f75c2

Please sign in to comment.