* localtime.c (tzparse): Fix bug in previous patch, so that we
don’t go past sp->ats limits.
---
localtime.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/localtime.c b/localtime.c
index ca3ba9d4..436a4b80 100644
--- a/localtime.c
+++ b/localtime.c
@@ -1764,20 +1764,20 @@ tzparse(const char *name, struct state *sp, struct
state const *basep)
if (reversed
|| (starttime < endtime
&& endtime - starttime < yearsecs)) {
- sp->ats[timecnt] = janfirst;
- if (! increment_overflow_time(&sp->ats[timecnt],
- janoffset + starttime)
- && atlo <= sp->ats[timecnt]) {
+ time_t at = janfirst;
+ if (! increment_overflow_time(&at, janoffset + starttime)
+ && atlo <= at) {
if (TZ_MAX_TIMES <= timecnt)
return false;
+ sp->ats[timecnt] = at;
sp->types[timecnt++] = !reversed;
}
- sp->ats[timecnt] = janfirst;
- if (! increment_overflow_time(&sp->ats[timecnt],
- janoffset + endtime)
- && atlo <= sp->ats[timecnt]) {
+ at = janfirst;
+ if (! increment_overflow_time(&at, janoffset + endtime)
+ && atlo <= at) {
if (TZ_MAX_TIMES <= timecnt)
return false;
+ sp->ats[timecnt] = at;
sp->types[timecnt++] = reversed;
}
}
--
2.53.0