* NEWS: Mention this. * localtime.c (tzloadbody): Avoid subscript error if timecnt is zero, which tzfile(5) allows. --- NEWS | 4 ++++ localtime.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 01873ab..34f7810 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,10 @@ Unreleased, experimental changes format that would allow TZif files with POSIX-style TZ strings and without transitions or time types. + A read-access subscript error in localtime.c has been fixed. + It could occur only in TZif files with timecnt == 0, something that + does not happen in practice now but could happen in future versions. + localtime.c no longer ignores TZif POSIX-style TZ strings that specify only standard time. Instead, these TZ strings now override the default time type for timestamps after the last diff --git a/localtime.c b/localtime.c index 9c31642..f205363 100644 --- a/localtime.c +++ b/localtime.c @@ -632,7 +632,8 @@ tzloadbody(char const *name, struct state *sp, bool doextend, sp->timecnt--; for (i = 0; i < ts->timecnt; i++) - if (sp->ats[sp->timecnt - 1] < ts->ats[i]) + if (sp->timecnt == 0 + || sp->ats[sp->timecnt - 1] < ts->ats[i]) break; while (i < ts->timecnt && sp->timecnt < TZ_MAX_TIMES) { -- 2.17.1