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:
parent
0fa401e680
commit
ecd30e037d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user