Zero out the struct tm supplied by the caller. Otherwise,

strange things might happen when garbage values in the struct
get passed in to localtime_r() and family.

Noticed by:	marcus
Approved by:	markm (mentor)(implicit)
This commit is contained in:
mtm 2003-04-05 05:46:43 +00:00
parent 0fa401e680
commit ecd30e037d

View File

@ -522,6 +522,7 @@ strptime(const char * __restrict buf, const char * __restrict fmt,
int gmt;
gmt = 0;
memset((void*)tm, 0, sizeof(struct tm));
ret = _strptime(buf, fmt, tm, &gmt);
if (ret) {
t = gmt ? timegm(tm) : mktime(tm);