Bug 8099 - Elm 2.5.1 has Y2K problem in expires
Elm 2.5.1 has Y2K problem in expires
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: elm (Show other bugs)
6.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
:
: 10908 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-01-01 10:53 EST by John Franks
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-01-04 08:52:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch to fixe elm Y2K bug (1.71 KB, patch)
2000-01-01 10:56 EST, John Franks
no flags Details | Diff

  None (edit)
Description John Franks 2000-01-01 10:53:37 EST
Elm has a Y2K problem in determining whether a message has expired.  There
are actually two bugs.  Years after 2000 are considered as 1900.  A second
bug causes nothing to be considered expired in 2000.  But everything will
be considered expired after 2001 since the expiration date will be assumed
to be in 1901.

Here is patch which fixes the problem.

--- expires.c.old       Fri Sep 29 12:42:07 1995
+++ expires.c   Sat Jan  1 09:31:32 2000
@@ -46,6 +46,7 @@
        time_t thetime;
        char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN],
word5[WLEN];
        int  month = 0, day = 0, year = 0, hour = 0, minute = 0, items;
+       int bad_year = FALSE;
 #ifndef        _POSIX_SOURCE
        struct tm *localtime();
        time_t time();
@@ -87,6 +88,7 @@
          day   = atoi(word1);
          month = month_number(word2);
          year  = atoi(word3);
+         bad_year = !isdigit( *word4);
          sscanf(word4, "%02d%*c%02d",
               &hour, &minute);
        }
@@ -100,25 +102,35 @@
              month = month_number(word3);
              day   = atoi(word2);
              year  = atoi(word4);
+             bad_year = !isdigit( *word4);
          } else {                                 /* form #1 */
              month = month_number(word2);
              day   = atoi(word3);
              year  = atoi(word4);
+             bad_year = !isdigit( *word4);
          }
        }
        else if (! isdigit(word1[0])) {            /* form #3 */
          month = month_number(word1);
          day   = atoi(word2);
          year  = atoi(word3);
+         bad_year = !isdigit( *word3);
        }
        else {                                     /* form #4 */
          day   = atoi(word1);
          month = month_number(word2);
          year  = atoi(word3);
+         bad_year = !isdigit( *word3);
        }

-       if (day == 0 || year == 0)
+       if (day == 0 || bad_year)
          return;                       /* we didn't get a valid date */
+
+       if ( year < 69)
+         year += 100;
+
+       if ( year >= 1900)
+         year -= 1900;

        /** next let's get the current time and date, please **/

--- date.c.old  Mon Apr  5 08:03:12 1999
+++ date.c      Sat Jan  1 09:31:24 2000
@@ -98,7 +98,7 @@

         /* now, finally, build the actual date string */
         the_time->tm_mday %= 32,
-       strftime(buffer, SLEN, "%a, %d %B %y", the_time);
+       strftime(buffer, SLEN, "%a, %d %B %Y", the_time);
 }
Comment 1 John Franks 2000-01-01 10:56:59 EST
Created attachment 48 [details]
patch to fixe elm Y2K bug
Comment 2 John Franks 2000-01-03 10:48:59 EST
There is an error in the patch listed in the report and in the attached
file.

Where the lines

          year  = atoi(word3);
 +         bad_year = !isdigit( *word4);

first occur (the first occurrence of !isdigit) the "*word4"  should be
changed to "*word3" so the lines become

           year  = atoi(word3);
 +         bad_year = !isdigit( *word3);
Comment 3 Jeff Johnson 2000-01-04 08:52:59 EST
Fixed in elm-2.5.2-1. Thanks for the patch.
Comment 4 Trond Eivind Glomsrxd 2001-04-18 16:50:38 EDT
*** Bug 10908 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.