]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[v4_1_esv] Treat dates greater than 2038 as never expire (infinite)
authorShawn Routhier <sar@isc.org>
Thu, 16 Apr 2015 03:00:43 +0000 (20:00 -0700)
committerShawn Routhier <sar@isc.org>
Thu, 16 Apr 2015 03:00:43 +0000 (20:00 -0700)
RELNOTES
common/parse.c

index 7aa073ab15b1a5a7762534e16ce5e9809bc2c377..c09004aacbda4606cfe5d50bd6ab8779337a4e55 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -85,6 +85,12 @@ by Eric Young (eay@cryptsoft.com).
   DHCPv4 it would not be written to the new lease file.
   [ISC-Bugs #37791]
 
+- When parsing dates for leases convert dates past 2038 to "never".
+  This avoids problems with integer overflows in the date and time
+  handling code for people that decide to use very large lease times
+  or add a lease entry with a date far in the future.
+  [ISC-Bugs #33056]
+
                        Changes since 4.1-ESV-R11rc2
 
 - None
index 7d27ce6e4875a3f6559dc2154770d6b9c64f44bd..1407cdb0c56fcec9d626d4a86a0a19cb16308441 100644 (file)
@@ -3,7 +3,7 @@
    Common parser code for dhcpd and dhclient. */
 
 /*
- * Copyright (c) 2004-2014 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2015 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-2003 by Internet Software Consortium
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -1108,6 +1108,13 @@ parse_date_core(cfile)
                return((TIME)0);
        }
 
+       /* If the year is 2038 or greater return the max time to avoid
+        * overflow issues.  We could try and be more precise but there
+        * doesn't seem to be a good reason to worry about it and waste
+        * the cpu looking at the rest of the date. */
+       if (year >= 138)
+               return(MAX_TIME);
+
        /* Guess the time value... */
        guess = ((((((365 * (year - 70) +       /* Days in years since '70 */
                      (year - 69) / 4 +         /* Leap days since '70 */