[Date Prev][Date Next] [Chronological] [Thread] [Top]

Year mishandling in libraries/libldap/templout.c (ITS#69)



Full_Name: Nick Cuccia
Version: 1.1.2
OS: SunOS 4.1.4
URL: ftp://ftp.openldap.org/incoming/cuccia-990205.tmplout-y2k-patch
Submission from: (NULL) (137.134.47.2)


The macro YEAR(y) in libraries is used to convert the contents of the
tm_year field of a struct tm to a four-digit year.  While it succeeds
when tm_year < 100, it incorrectly handles values >= 100.

Note that in the year 2000 and beyond, the value contained in the tm_year
field of SunOS (and most, if not all, other Unix and Unix-like systems)
will be 100 or more.  Given the current implementation of YEAR(y), the
gtime() function (which calculates a time_t based when given a struct tm)
will generate incorrect return values after 1/1/2000.

I've placed a patch which fixes this in the URL included below.

--Nick