lynx-dev
[Top][All Lists]
Advanced

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

[Lynx-dev] Year 2038 problem in handling cookie date


From: patakuti
Subject: [Lynx-dev] Year 2038 problem in handling cookie date
Date: Wed, 31 Oct 2018 23:18:27 +0900 (JST)

I found a site sending a cookie whose gobble date is after January 2038.
https://tabi-labo.com/

Lynx crashes when accessing the site with 32-bit system.
I wrote an ad-hoc patch to prevent the crash.
diff -rub orig/lynx2.8.9dev.16/src/parsdate.c lynx2.8.9dev.16/src/parsdate.c
--- orig/lynx2.8.9dev.16/src/parsdate.c Sat Jan 05 11:00:30 2013
+++ lynx2.8.9dev.16/src/parsdate.c      Sun Oct 28 17:34:05 2018
@@ -653,8 +653,16 @@
     }
     Julian += tod;
     tod = Julian;
-    if (dst == DSTon || (dst == DSTmaybe && localtime(&tod)->tm_isdst))
+    struct tm *tm;
+    tm = localtime(&tod);
+    if ((tm != NULL) && (Julian >= 0)) {
+       if (dst == DSTon || (dst == DSTmaybe && tm->tm_isdst)) {
        Julian -= DST_OFFSET * 60 * 60;
+       }
+    }
+    else {
+       Julian = LONG_MAX;
+    }
     return Julian;
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]