initialize struct tm
strptime() does not initialize at least tm_isdst, which leads to an uninited value reference in mktime().
This commit is contained in:
parent
62a60997c3
commit
8e49300cf7
|
@ -824,6 +824,7 @@ parse_date( const char *str )
|
||||||
int hours, mins;
|
int hours, mins;
|
||||||
struct tm datetime;
|
struct tm datetime;
|
||||||
|
|
||||||
|
memset( &datetime, 0, sizeof(datetime) );
|
||||||
if (!(end = strptime( str, "%d-%b-%Y %H:%M:%S ", &datetime )))
|
if (!(end = strptime( str, "%d-%b-%Y %H:%M:%S ", &datetime )))
|
||||||
return -1;
|
return -1;
|
||||||
if ((date = mktime( &datetime )) == -1)
|
if ((date = mktime( &datetime )) == -1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user