summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdtime/strptime.c
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-04-05 05:46:43 +0000
committermtm <mtm@FreeBSD.org>2003-04-05 05:46:43 +0000
commit80f7682694bee604ce863e85d3059073d2772839 (patch)
treed962f3454fd9adcb261dc657468ff04170ae0fd4 /lib/libc/stdtime/strptime.c
parentf56971b4a932159fe9e810a47feec1829c2a2fbc (diff)
downloadFreeBSD-src-80f7682694bee604ce863e85d3059073d2772839.zip
FreeBSD-src-80f7682694bee604ce863e85d3059073d2772839.tar.gz
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)
Diffstat (limited to 'lib/libc/stdtime/strptime.c')
-rw-r--r--lib/libc/stdtime/strptime.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c
index 21a47f7..becdd95 100644
--- a/lib/libc/stdtime/strptime.c
+++ b/lib/libc/stdtime/strptime.c
@@ -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);
OpenPOWER on IntegriCloud