Blame SOURCES/dhcp-4.2.4-P1-interval.patch
|
|
fad460 |
diff -up dhcp-4.2.4/common/dispatch.c.foo dhcp-4.2.4/common/dispatch.c
|
|
|
fad460 |
--- dhcp-4.2.4/common/dispatch.c.foo 2012-07-26 21:31:43.875349675 -0500
|
|
|
fad460 |
+++ dhcp-4.2.4/common/dispatch.c 2012-07-26 21:39:14.961710319 -0500
|
|
|
fad460 |
@@ -324,7 +324,20 @@ void add_timeout (when, where, what, ref
|
|
|
fad460 |
q->next = timeouts;
|
|
|
fad460 |
timeouts = q;
|
|
|
fad460 |
|
|
|
fad460 |
- isc_interval_set(&interval, sec & DHCP_SEC_MAX, usec * 1000);
|
|
|
fad460 |
+ /* isc_time_nowplusinterval() is not safe with 64-bit time_t and will
|
|
|
fad460 |
+ * return an error for sufficiently large intervals. We have to limit
|
|
|
fad460 |
+ * the interval to INT_MAX or less to ensure the interval doesn't
|
|
|
fad460 |
+ * overflow 32 bits, since the returned isc_time_t fields are
|
|
|
fad460 |
+ * 32-bit unsigned ints.
|
|
|
fad460 |
+ *
|
|
|
fad460 |
+ * HACK: The 9 is a magic number of seconds, since some time may have
|
|
|
fad460 |
+ * gone by since the last call to gettimeofday() and the one in
|
|
|
fad460 |
+ * isc_time_nowplusinterval().
|
|
|
fad460 |
+ */
|
|
|
fad460 |
+ if (sec > TIME_MAX)
|
|
|
fad460 |
+ sec = TIME_MAX - 9;
|
|
|
fad460 |
+
|
|
|
fad460 |
+ isc_interval_set(&interval, sec, usec * 1000);
|
|
|
fad460 |
status = isc_time_nowplusinterval(&expires, &interval);
|
|
|
fad460 |
if (status != ISC_R_SUCCESS) {
|
|
|
fad460 |
/*
|