Mercurial > hg > octave-nkf > gnulib-hg
changeset 10285:764e0dd7e8d4
mktime.c: normalize tp->tm_isdst value to -1/0/1.
* lib/mktime.c (__mktime_internal): Normalize tp->tm_isdst value.
Reported by Michael Ringe <Michael.Ringe@gmx.de> in
<http://sourceware.org/bugzilla/show_bug.cgi?id=6723>.
author | Ulrich Drepper <drepper@redhat.com> |
---|---|
date | Wed, 23 Jul 2008 16:19:15 +0200 |
parents | d76cc695b4c6 |
children | 12944217dba7 |
files | ChangeLog lib/mktime.c |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-07-23 Ulrich Drepper <drepper@redhat.com> + mktime.c: normalize tp->tm_isdst value to -1/0/1. + * lib/mktime.c (__mktime_internal): Normalize tp->tm_isdst value. + Reported by Michael Ringe <Michael.Ringe@gmx.de> in + <http://sourceware.org/bugzilla/show_bug.cgi?id=6723>. + * lib/canonicalize-lgpl.c (__realpath): Avoid buffer overflow after readlink on platforms without PATH_MAX.
--- a/lib/mktime.c +++ b/lib/mktime.c @@ -290,7 +290,9 @@ int mday = tp->tm_mday; int mon = tp->tm_mon; int year_requested = tp->tm_year; - int isdst = tp->tm_isdst; + /* Normalize the value. */ + int isdst = ((tp->tm_isdst >> (8 * sizeof (tp->tm_isdst) - 1)) + | (tp->tm_isdst != 0)); /* 1 if the previous probe was DST. */ int dst2;