HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

WARNING! Hylafax Y2K bug found



In the course of my Y2K testing of Hylafax 4.0pl2 I've found a rather nasty
little bug. This isn't a Y2K bug per se, but 2000 is a year which will
trigger it.

In util/AtSyntax.c++ there is a very carefully constructed macro for
determining if a passed year is leap year. Unfortunately, everytime it is
called, it is called with the tm_year element of a tm struct which is
actually year - 1900. This caused Hylafax to miss the fact that 2000 IS a
leap year. To prove to yourself, set your test system's time to Feb 29th
2000 (or later in the year) and send a fax with the "-a" option (such as -a
now). The fax will be scheduled for the next day.

Here's the correct macro (split for readability):

#define isLeapYear(y)   ((((y)+TM_YEAR_BASE) % 4) == 0 && \
                         (((y)+TM_YEAR_BASE) % 100) != 0 || \
                         (((y)+TM_YEAR_BASE) % 400) == 0)

--
Ken Cornetet Kimball Electronics Group 812.634.4482
Good, Fast, Cheap - Pick Two.




Project hosted by iFAX Solutions