Use secure versions of time/string functions on Windows.
This commit is contained in:
parent
5da73d4efc
commit
0d6aef8491
@ -655,17 +655,12 @@ datetime::datetime(const datetime& d)
|
|||||||
|
|
||||||
datetime::datetime(const time_t t, const int zone)
|
datetime::datetime(const time_t t, const int zone)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
|
||||||
// These functions are reentrant in MS C runtime library
|
|
||||||
struct tm* gtm = gmtime(&t);
|
|
||||||
struct tm* ltm = localtime(&t);
|
|
||||||
|
|
||||||
|
#if VMIME_HAVE_LOCALTIME_S
|
||||||
struct tm tms;
|
struct tm tms;
|
||||||
|
|
||||||
if (gtm)
|
if (!gmtime_r(&tms, &t))
|
||||||
tms = *gtm;
|
localtime_r(&tms, &t);
|
||||||
else if (ltm)
|
|
||||||
tms = *ltm;
|
|
||||||
#elif VMIME_HAVE_LOCALTIME_R
|
#elif VMIME_HAVE_LOCALTIME_R
|
||||||
struct tm tms;
|
struct tm tms;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ const vmime::string windowsHandler::getHostName() const
|
|||||||
return hostname;
|
return hostname;
|
||||||
|
|
||||||
if (::strlen(hostname) == 0)
|
if (::strlen(hostname) == 0)
|
||||||
::strcpy(hostname, "localhost");
|
::strcpy_s(hostname, "localhost");
|
||||||
|
|
||||||
// Try to get canonical name for the hostname
|
// Try to get canonical name for the hostname
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
|
Loading…
Reference in New Issue
Block a user