mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* time/tzset.c (tzset_internal): Correct parsing of TZ envvar.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
2009-02-24 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* time/tzset.c (tzset_internal): Correct parsing of TZ envvar.
|
||||||
|
|
||||||
2009-02-22 Ulrich Drepper <drepper@redhat.com>
|
2009-02-22 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* po/bg.po: Update from translation team.
|
* po/bg.po: Update from translation team.
|
||||||
|
48
time/tzset.c
48
time/tzset.c
@ -174,14 +174,26 @@ __tzset_parse_tz (tz)
|
|||||||
/* Get the standard timezone name. */
|
/* Get the standard timezone name. */
|
||||||
tzbuf = strdupa (tz);
|
tzbuf = strdupa (tz);
|
||||||
|
|
||||||
if (sscanf (tz, "%[^0-9,+-]", tzbuf) != 1 ||
|
if (sscanf (tz, "%[A-Za-z]", tzbuf) != 1)
|
||||||
(l = strlen (tzbuf)) < 3)
|
{
|
||||||
|
/* Check for the quoted version. */
|
||||||
|
char *wp = tzbuf;
|
||||||
|
if (*tz++ != '<')
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
while (isalnum (*tz) || *tz == '+' || *tz == '-')
|
||||||
|
*wp++ = *tz++;
|
||||||
|
if (*tz++ != '>' || wp - tzbuf < 3)
|
||||||
|
goto out;
|
||||||
|
*wp = '\0';
|
||||||
|
}
|
||||||
|
else if ((l = strlen (tzbuf)) < 3)
|
||||||
goto out;
|
goto out;
|
||||||
|
else
|
||||||
|
tz += l;
|
||||||
|
|
||||||
tz_rules[0].name = __tzstring (tzbuf);
|
tz_rules[0].name = __tzstring (tzbuf);
|
||||||
|
|
||||||
tz += l;
|
|
||||||
|
|
||||||
/* Figure out the standard offset from UTC. */
|
/* Figure out the standard offset from UTC. */
|
||||||
if (*tz == '\0' || (*tz != '+' && *tz != '-' && !isdigit (*tz)))
|
if (*tz == '\0' || (*tz != '+' && *tz != '-' && !isdigit (*tz)))
|
||||||
goto out;
|
goto out;
|
||||||
@ -217,14 +229,32 @@ __tzset_parse_tz (tz)
|
|||||||
if (*tz != '\0')
|
if (*tz != '\0')
|
||||||
{
|
{
|
||||||
char *n = tzbuf + strlen (tzbuf) + 1;
|
char *n = tzbuf + strlen (tzbuf) + 1;
|
||||||
if (sscanf (tz, "%[^0-9,+-]", n) != 1 ||
|
|
||||||
(l = strlen (n)) < 3)
|
if (sscanf (tz, "%[A-Za-z]", tzbuf) != 1)
|
||||||
goto done_names; /* Punt on name, set up the offsets. */
|
{
|
||||||
|
/* Check for the quoted version. */
|
||||||
|
char *wp = tzbuf;
|
||||||
|
const char *rp = tz;
|
||||||
|
if (*rp++ != '<')
|
||||||
|
/* Punt on name, set up the offsets. */
|
||||||
|
goto done_names;
|
||||||
|
|
||||||
|
while (isalnum (*rp) || *rp == '+' || *rp == '-')
|
||||||
|
*wp++ = *rp++;
|
||||||
|
if (*rp++ != '>' || wp - tzbuf < 3)
|
||||||
|
/* Punt on name, set up the offsets. */
|
||||||
|
goto done_names;
|
||||||
|
*wp = '\0';
|
||||||
|
tz = rp;
|
||||||
|
}
|
||||||
|
else if ((l = strlen (tzbuf)) < 3)
|
||||||
|
/* Punt on name, set up the offsets. */
|
||||||
|
goto done_names;
|
||||||
|
else
|
||||||
|
tz += l;
|
||||||
|
|
||||||
tz_rules[1].name = __tzstring (n);
|
tz_rules[1].name = __tzstring (n);
|
||||||
|
|
||||||
tz += l;
|
|
||||||
|
|
||||||
/* Figure out the DST offset from GMT. */
|
/* Figure out the DST offset from GMT. */
|
||||||
if (*tz == '-' || *tz == '+')
|
if (*tz == '-' || *tz == '+')
|
||||||
tz_rules[1].offset = *tz++ == '-' ? 1L : -1L;
|
tz_rules[1].offset = *tz++ == '-' ? 1L : -1L;
|
||||||
|
Reference in New Issue
Block a user