W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1999

Y2K bug of w3c-libwww-5.2.8/Library/src/HTWWWStr.c:HTParseTime() ?

From: Noriyuki Soda <soda@sra.co.jp>
Date: Tue, 28 Dec 1999 06:00:28 -0500 (EST)
Message-Id: <199912281100.UAA20908@srapc342.sra.co.jp>
To: www-lib@w3.org
CC: soda@sra.co.jp
Hi,

Perhaps this is silly question, but...
Doesn't the HTParseTime() function of latest w3c-libwww (version 5.2.8)
have Y2K bug?

This function parses a year of RFC850/RFC1036 format which is something 
like "Sunday, 06-Nov-94 08:49:37 GMT" (defined in RFC2616), but
according piece of the code (line 429 of the HTWWWStr.c) is below:
	    tm.tm_year = strtol(++s, &s, 10);
Because tm.tm_year is defined as tm.tm_year == (REAL_YEAR - 1900),
this line seems to have to be changed like follows:
	    tm.tm_year = strtol(++s, &s, 10);
	    if (tm.tm_year < 70)
		tm.tm_year += 100;

I've checked the source in cvsweb (*1), but the function HTParseTime()
is not fixed, yet.

I also think that it is better to fix line 507 of the HTWWWStr.c.
    if (.... || tm.tm_year >120) {
	HTTRACE(CORE_TRACE, "ERROR....... Parsed illegal time: %02d.%02d.%02d %02d:%02d:%02d\n" _
Because tm.tm_year > 120 is completely valid.

P.S.
Pleaes Cc: <soda@sra.co.jp>, since I'm not subscribing www-lib mailing 
list.

(*1)
http://dev.w3.org/cvsweb/libwww/Library/src/HTWWWStr.c
--
soda@sra.co.jp		Software Research Associates, Inc., Japan
(Noriyuki Soda)		   IT Industry System Division Group 3
Received on Tuesday, 28 December 1999 16:21:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:35 GMT