x509_get_current_time() uses localtime_r() to prevent thread issues
diff --git a/library/x509parse.c b/library/x509parse.c
index 16b0149..085a3cf 100644
--- a/library/x509parse.c
+++ b/library/x509parse.c
@@ -3092,18 +3092,18 @@
now->min = st.wMinute;
now->sec = st.wSecond;
#else
- struct tm *lt;
+ struct tm lt;
time_t tt;
tt = time( NULL );
- lt = localtime( &tt );
+ localtime_r( &tt, < );
- now->year = lt->tm_year + 1900;
- now->mon = lt->tm_mon + 1;
- now->day = lt->tm_mday;
- now->hour = lt->tm_hour;
- now->min = lt->tm_min;
- now->sec = lt->tm_sec;
+ now->year = lt.tm_year + 1900;
+ now->mon = lt.tm_mon + 1;
+ now->day = lt.tm_mday;
+ now->hour = lt.tm_hour;
+ now->min = lt.tm_min;
+ now->sec = lt.tm_sec;
#endif
}