diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-09-13 22:49:45 -0700 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-10-07 11:09:16 -0300 |
commit | 645277434a42efc547d2cac8bfede4da10b4049f (patch) | |
tree | ed59ee9ea0c2f0cf3ba112325dfc1c059f741251 /time | |
parent | f2e06656d04a9fcb0603802a4f8ce7aa3a1f055e (diff) | |
download | glibc-645277434a42efc547d2cac8bfede4da10b4049f.tar.gz glibc-645277434a42efc547d2cac8bfede4da10b4049f.tar.xz glibc-645277434a42efc547d2cac8bfede4da10b4049f.zip |
Fix subscript error with odd TZif file [BZ #28338]
* time/tzfile.c (__tzfile_compute): Fix unlikely off-by-one bug that accessed before start of an array when an oddball-but-valid TZif file was queried with an unusual time_t value. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'time')
-rw-r--r-- | time/tzfile.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/time/tzfile.c b/time/tzfile.c index 4377018a55..190a777152 100644 --- a/time/tzfile.c +++ b/time/tzfile.c @@ -765,8 +765,7 @@ __tzfile_compute (__time64_t timer, int use_localtime, *leap_correct = leaps[i].change; if (timer == leaps[i].transition /* Exactly at the transition time. */ - && ((i == 0 && leaps[i].change > 0) - || leaps[i].change > leaps[i - 1].change)) + && (leaps[i].change > (i == 0 ? 0 : leaps[i - 1].change))) { *leap_hit = 1; while (i > 0 |