[PATCH] Bug in __tzfile_read function

Szymon Siwek sls@poczta.wp.pl
Sat Nov 3 19:54:00 GMT 2007


Hello!

I believe there's a bug in __tzfile_read function, fixed by following
patch:

--- glibc-2.7/time/tzfile.c.orig        2007-11-01 11:28:53.717388999 +0000
+++ glibc-2.7/time/tzfile.c     2007-11-01 11:29:33.711287677 +0000
@@ -381,7 +381,7 @@
       else
        tzspec[tzspec_len - 1] = '\0';
     }
-  else if (sizeof (time_t) == 4 && tzhead.tzh_version != '\0')
+  else if (sizeof (time_t) == 4 && tzhead.tzh_version[0] != '\0')
     {
       /* Get the TZ string.  */
       if (__builtin_expect (fread_unlocked ((void *) &tzhead, sizeof (tzhead),

There is no point to check value of tzhead.tzh_version because it's always
differs from 0.

-- 
Szymon Siwek



More information about the Libc-alpha mailing list