Aug. 9, 2004
8:46 p.m.
Olson, Arthur David (NIH/NCI) said:
However, zdump.c might be compiled with a version of localtime or gmtime that does something evil, so defensive programming may be in order.
True.
Casts along the lines shown below should do the trick.
--ado
if (timeptr->tm_wday < 0 || timeptr->tm_wday >= (int) (sizeof wday_name / sizeof wday_name[0]))
if ((unsigned) timeptr->tm_wday >= sizeof wday_name / sizeof wday_name[0]) makes it one comparison instead of two. -- Clive D.W. Feather | Work: <clive@demon.net> | Tel: +44 20 8495 6138 Internet Expert | Home: <clive@davros.org> | Fax: +44 870 051 9937 Demon Internet | WWW: http://www.davros.org | Mobile: +44 7973 377646 Thus plc | |