File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3652,6 +3652,9 @@ static int wolfssl_asn1_time_to_tm(const WOLFSSL_ASN1_TIME* asnTime,
36523652 const unsigned char * asn1TimeBuf ;
36533653 int asn1TimeBufLen ;
36543654 int i = 0 ;
3655+ #ifdef XMKTIME
3656+ struct tm localTm = {0 };
3657+ #endif
36553658
36563659 /* Get the string buffer - fixed array, can't fail. */
36573660 asn1TimeBuf = wolfSSL_ASN1_TIME_get_data (asnTime );
@@ -3706,8 +3709,13 @@ static int wolfssl_asn1_time_to_tm(const WOLFSSL_ASN1_TIME* asnTime,
37063709 tm -> tm_sec += (asn1TimeBuf [i ] - '0' );
37073710
37083711 #ifdef XMKTIME
3709- /* Call XMKTIME on tm to get tm_wday and tm_yday fields populated. */
3710- XMKTIME (tm );
3712+ XMEMCPY (& localTm , tm , sizeof (struct tm ));
3713+ /* Call XMKTIME on tm to get tm_wday and tm_yday fields populated.
3714+ Note that localTm is used here to avoid modifying other fields,
3715+ such as tm_isdst/tm_gmtoff. */
3716+ XMKTIME (& localTm );
3717+ tm -> tm_wday = localTm .tm_wday ;
3718+ tm -> tm_yday = localTm .tm_yday ;
37113719 #endif
37123720 }
37133721
You can’t perform that action at this time.
0 commit comments