[openssl-dev] [openssl.org #4489] PATCH: fix Windows deprecated strdup in crypto\conf\conf_lib.c

Viktor Dukhovni openssl-users at dukhovni.org
Mon Mar 28 13:16:21 UTC 2016


> On Mar 28, 2016, at 4:38 AM, noloader at gmail.com via RT <rt at openssl.org> wrote:
> 
> On Windows, the fix below also depends upon the patch from Issue 4488
> ("The POSIX name for this item is deprecated. Instead, use the ISO C++
> conformant name...").
> 
> This patch below also fixes some problems with the older standards on
> Fedora, BSD and Linux.
> 
> $ cat conf_lib.patch
> diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
> index f197714..7bc3ac0 100644
> --- a/crypto/conf/conf_lib.c
> +++ b/crypto/conf/conf_lib.c
> @@ -392,7 +392,7 @@ void
> OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
>                                       const char *config_file)
> {
>     free(settings->config_name);
> -    settings->config_name = config_file == NULL ? NULL : strdup(config_file);
> +    settings->config_name = config_file == NULL ? NULL :
> OPENSSL_strdup(config_file);
> }
> #endif

If you're going to change strdup -> OPENSSL_strdup, then the previous
line needs to also change free -> OPENSSL_free.

-- 
	Viktor.



More information about the openssl-dev mailing list