This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] For bogus TZ values use offset 0 rather than 1 or -1


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]