diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-09-25 18:11:25 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-09-25 18:28:30 -0700 |
commit | 619700e1b278d530ea254fd74fceda3ce7eea6d3 (patch) | |
tree | feac5b2cb772027a1a5f87a291c446b12c1fbd28 /lib/parse-datetime.y | |
parent | ad8ece88d4d22223218cc51a8fa4a3ec5f512e70 (diff) | |
download | gnulib-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/parse-datetime.y')
-rw-r--r-- | lib/parse-datetime.y | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y index 9eff2dc3b9..f8da02d3f3 100644 --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -2034,7 +2034,13 @@ parse_datetime2 (struct timespec *result, char const *p, if (pc.local_zones_seen) tm.tm_isdst = pc.local_isdst; - tm0 = tm; + tm0.tm_sec = tm.tm_sec; + tm0.tm_min = tm.tm_min; + tm0.tm_hour = tm.tm_hour; + tm0.tm_mday = tm.tm_mday; + tm0.tm_mon = tm.tm_mon; + tm0.tm_year = tm.tm_year; + tm0.tm_isdst = tm.tm_isdst; Start = mktime_z (tz, &tm); @@ -2064,7 +2070,13 @@ parse_datetime2 (struct timespec *result, char const *p, dbg_printf (_("error: tzalloc (\"%s\") failed\n"), tz2buf); goto fail; } - tm = tm0; + tm.tm_sec = tm0.tm_sec; + tm.tm_min = tm0.tm_min; + tm.tm_hour = tm0.tm_hour; + tm.tm_mday = tm0.tm_mday; + tm.tm_mon = tm0.tm_mon; + tm.tm_year = tm0.tm_year; + tm.tm_isdst = tm0.tm_isdst; Start = mktime_z (tz2, &tm); repaired = mktime_ok (tz2, &tm0, &tm, Start); tzfree (tz2); |