--- a/zic.c 2013-10-01 03:41:02.000000000 +0100 +++ b/zic.c 2014-03-20 09:56:21.484075489 +0000 @@ -161,6 +161,7 @@ static const char * rfilename; static int rlinenum; static const char * progname; +static int timespc; static int timecnt; static int typecnt; @@ -346,7 +347,7 @@ static struct attype { zic_t at; unsigned char type; -} attypes[TZ_MAX_TIMES]; +} * attypes; static zic_t gmtoffs[TZ_MAX_TYPES]; static char isdsts[TZ_MAX_TYPES]; static unsigned char abbrinds[TZ_MAX_TYPES]; @@ -1434,8 +1435,8 @@ static char * fullname; static const struct tzhead tzh0; static struct tzhead tzh; - zic_t ats[TZ_MAX_TIMES]; - unsigned char types[TZ_MAX_TIMES]; + zic_t * ats = emalloc(sizeof(zic_t) * timecnt); + unsigned char * types = emalloc(timecnt); /* ** Sort. @@ -1539,7 +1540,7 @@ register int thistimei, thistimecnt; register int thisleapi, thisleapcnt; register int thistimelim, thisleaplim; - int writetype[TZ_MAX_TIMES]; + int writetype[TZ_MAX_TYPES]; int typemap[TZ_MAX_TYPES]; register int thistypecnt; char thischars[TZ_MAX_CHARS]; @@ -1751,6 +1752,8 @@ progname, fullname); exit(EXIT_FAILURE); } + free(ats); + free(types); } static void @@ -2370,9 +2373,9 @@ timecnt = 0; type = 0; } - if (timecnt >= TZ_MAX_TIMES) { - error(_("too many transitions?!")); - exit(EXIT_FAILURE); + if (timecnt == timespc) { + timespc = (timespc << 2) + 16; + attypes = erealloc(attypes, sizeof(*attypes) * timespc); } attypes[timecnt].at = starttime; attypes[timecnt].type = type;