[PATCH] For bogus TZ values use offset 0 rather than 1 or -1
Jakub Jelinek
jakub@redhat.com
Mon Dec 6 22:45:00 GMT 2004
Hi!
For say TZ=FOOT+X or TZ=BAR-
tzset doesn't use UTC, but offset -1L resp. 1L. While user's
shouldn't expect anything particular in that case, I think it
is better to clear offset if the sscanf after first + or -
fails.
2004-12-06 Jakub Jelinek <jakub@redhat.com>
* time/tzset.c (tzset_internal): If + or - is seen,
but no offset after it, reset offset to 0. [BZ #601]
--- libc/time/tzset.c.jj 2004-09-16 11:35:42.000000000 +0200
+++ libc/time/tzset.c 2004-12-06 23:07:17.034717956 +0100
@@ -240,6 +240,7 @@ tzset_internal (always, explicit)
switch (sscanf (tz, "%hu:%hu:%hu", &hh, &mm, &ss))
{
default:
+ tz_rules[0].offset = 0;
goto out;
case 1:
mm = 0;
Jakub
More information about the Libc-hacker
mailing list