>>> $ 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...

The odd thing with this one was, the switch from strdup to _strdup
should have occurred with the patch from Issue 4488 occurred. For some
reason, the text substitution was not occurring, even after including
the header "openssl/e_os.h" in conf_lib.c.

I'm probably missing some other interaction among the headers.

For completeness, below is the thrust of the 4488 patch. If
Microsoft's compiler is from Visual Studio 2003 or above, then follow
Microsoft's recommendations reported in the warning.

***********

$ git diff e_os.h > e_os.patch
$ cat e_os.patch
diff --git a/e_os.h b/e_os.h
index f0a441e..1fe3ffb 100644
--- a/e_os.h
+++ b/e_os.h
@@ -520,6 +520,13 @@ struct servent *PASCAL getservbyname(const char
*, const char *);
 # if defined(OPENSSL_SYS_WINDOWS)
 #  define strcasecmp _stricmp
 #  define strncasecmp _strnicmp
+#  if (_MSC_VER >= 1310)
+#   define open _open
+#   define fdopen _fdopen
+#   define close _close
+#   define strdup _strdup
+#   define unlink _unlink
+#  endif

 # elif defined(OPENSSL_SYS_VMS)
 /* VMS below version 7.0 doesn't have strcasecmp() */
 #  include "internal/o_str.h"
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to