x509_get_current_time() uses localtime_r() to prevent thread issues

This commit is contained in:
Paul Bakker 2014-07-08 12:14:37 +02:00
parent 24aaf44120
commit 358a841b34
2 changed files with 9 additions and 9 deletions

View file

@ -41,7 +41,7 @@ Bugfix
out_ctr failed out_ctr failed
* ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc * ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc
of one of them failed of one of them failed
* x509_get_current_time() uses localtime_r() to prevent thread issues
= Version 1.2.10 released 2013-10-07 = Version 1.2.10 released 2013-10-07
Changes Changes

View file

@ -3092,18 +3092,18 @@ static void x509_get_current_time( x509_time *now )
now->min = st.wMinute; now->min = st.wMinute;
now->sec = st.wSecond; now->sec = st.wSecond;
#else #else
struct tm *lt; struct tm lt;
time_t tt; time_t tt;
tt = time( NULL ); tt = time( NULL );
lt = localtime( &tt ); localtime_r( &tt, &lt );
now->year = lt->tm_year + 1900; now->year = lt.tm_year + 1900;
now->mon = lt->tm_mon + 1; now->mon = lt.tm_mon + 1;
now->day = lt->tm_mday; now->day = lt.tm_mday;
now->hour = lt->tm_hour; now->hour = lt.tm_hour;
now->min = lt->tm_min; now->min = lt.tm_min;
now->sec = lt->tm_sec; now->sec = lt.tm_sec;
#endif #endif
} }