Skip to content

Commit 221619a

Browse files
committed
Modernize zic's test for valid timezone abbreviations.
We really need to sync all of our IANA-derived timezone code with upstream, but that's going to be a large patch and I certainly don't care to shove such a thing into stable branches immediately before a release. As a stopgap, copy just the tzcode2016c logic that checks validity of timezone abbreviations. This prevents getting multiple "time zone abbreviation differs from POSIX standard" bleats with tzdata 2014b and later.
1 parent 76281aa commit 221619a

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/timezone/zic.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,30 +2792,15 @@ newabbr(const char *string)
27922792
const char *cp;
27932793
char *wp;
27942794

2795-
/*
2796-
* Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics optionally
2797-
* followed by a + or - and a number from 1 to 14.
2798-
*/
27992795
cp = string;
28002796
wp = NULL;
2801-
while (isascii((unsigned char) *cp) &&
2802-
isalpha((unsigned char) *cp))
2797+
while (isalpha((unsigned char) *cp) || ('0' <= *cp && *cp <= '9')
2798+
|| *cp == '-' || *cp == '+')
28032799
++cp;
2804-
if (cp - string == 0)
2805-
wp = _("time zone abbreviation lacks alphabetic at start");
2806-
if (noise && cp - string > 3)
2807-
wp = _("time zone abbreviation has more than 3 alphabetics");
2800+
if (noise && cp - string < 3)
2801+
wp = _("time zone abbreviation has fewer than 3 characters");
28082802
if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
2809-
wp = _("time zone abbreviation has too many alphabetics");
2810-
if (wp == NULL && (*cp == '+' || *cp == '-'))
2811-
{
2812-
++cp;
2813-
if (isascii((unsigned char) *cp) &&
2814-
isdigit((unsigned char) *cp))
2815-
if (*cp++ == '1' &&
2816-
*cp >= '0' && *cp <= '4')
2817-
++cp;
2818-
}
2803+
wp = _("time zone abbreviation has too many characters");
28192804
if (*cp != '\0')
28202805
wp = _("time zone abbreviation differs from POSIX standard");
28212806
if (wp != NULL)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy