summaryrefslogtreecommitdiff
path: root/lib/posixtm.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-09-25 18:11:25 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-09-25 18:28:30 -0700
commit619700e1b278d530ea254fd74fceda3ce7eea6d3 (patch)
treefeac5b2cb772027a1a5f87a291c446b12c1fbd28 /lib/posixtm.c
parentad8ece88d4d22223218cc51a8fa4a3ec5f512e70 (diff)
downloadgnulib-619700e1b278d530ea254fd74fceda3ce7eea6d3.tar.gz
parse-datetime, posixtm: avoid uninit access
* lib/parse-datetime.y (parse_datetime2): * lib/posixtm.c (posixtime): Do not access uninitialized storage, even though the resulting value is never used.
Diffstat (limited to 'lib/posixtm.c')
-rw-r--r--lib/posixtm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/posixtm.c b/lib/posixtm.c
index 26a35dd3fc..030f704f06 100644
--- a/lib/posixtm.c
+++ b/lib/posixtm.c
@@ -182,7 +182,12 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits)
if (! posix_time_parse (&tm0, s, syntax_bits))
return false;
- tm1 = tm0;
+ tm1.tm_sec = tm0.tm_sec;
+ tm1.tm_min = tm0.tm_min;
+ tm1.tm_hour = tm0.tm_hour;
+ tm1.tm_mday = tm0.tm_mday;
+ tm1.tm_mon = tm0.tm_mon;
+ tm1.tm_year = tm0.tm_year;
tm1.tm_isdst = -1;
t = mktime (&tm1);