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

Andy Polyakov via RT rt at openssl.org
Tue Mar 29 11:50:32 UTC 2016


On 03/28/16 15:16, Viktor Dukhovni via RT wrote:
> 
>> 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.

Few lines up there is rationale for malloc/free and by association
strdup. Switching to OPENSSL_[strdup|malloc|free] goes against it. On
Windows one can/should switch to _strdup (it also solves another real
yet subtle problem, not just warning). If lack of strdup is concern
(relly? which Fedora, BSD, Linux can it be?), then one might have to
consider local few-liner implementation. And conf_sap.c suffers from
this too...


-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4489
Please log in as guest with password guest if prompted



More information about the openssl-dev mailing list