Y2K-Bug in INN 1.x, 2.x

Katsuhiro Kondou kondou at nec.co.jp
Wed Jan 5 02:33:39 UTC 2000


In article <200001042125.WAA08608 at super.du.uab.ericsson.se>,
	Per Hedeland <per at erix.ericsson.se> wrote;

} This patch, when applied to parsedate.y from INN-2.2 or later (where
} only the first chunk "fits", the other two are already effectively in
} place...) breaks (some) handling of dates with two-digit years - I guess
} 00 gets treated as 1900 rather than 2000, which it does with the
} original parsedate.y:
} 
} Jan  3 22:54:07 news rnews: rejected 437 Bad "Date" header -- "3 Jan 00 21:48:34 GMT"

Attached will work for you.  This assumes 'YY' as current
century.  I'll commit unless there is any problem.

--- lib/parsedate.y.orig	Mon Jan  3 15:55:44 2000
+++ lib/parsedate.y	Wed Jan  5 11:27:53 2000
@@ -260,7 +260,7 @@
 		    yyYear = $5;
 		} else {
 		    /* assume year is YY format, so need to add 1900 */
-		    yyYear = $5 + 1900;
+		    yyYear = $5 + (yyYear - 1900)/100 * 100 + 1900;
 		}
 	    }
 	}
@@ -276,7 +276,7 @@
 		yyYear = $4;
 	    } else {
 		/* assume year is YY format, so need to add 1900 */
-		yyYear = $4 + 1900;
+		yyYear = $4 + (yyYear - 1900)/100 * 100 + 1900;
 	    }
 	}
 	| tUNUMBER tMONTH {
@@ -291,7 +291,7 @@
 		yyYear = $3;
 	    } else {
 		/* assume year is YY format, so need to add 1900 */
-		yyYear = $3 + 1900;
+		yyYear = $3 + (yyYear - 1900)/100 * 100 + 1900;
 	    }
 	}
 	| tDAY ',' tUNUMBER tMONTH tUNUMBER {
@@ -302,7 +302,7 @@
 		yyYear = $5;
 	    } else {
 		/* assume year is YY format, so need to add 1900 */
-		yyYear = $5 + 1900;
+		yyYear = $5 + (yyYear - 1900)/100 * 100 + 1900;
 	    }
 	}
 	;

-- 
Katsuhiro Kondou



More information about the inn-workers mailing list