+* [Bug 1735] 'clocktime()' aborts ntpd on bogus input
(4.2.7p87) 2010/12/01 Released by Harlan Stenn <stenn@ntp.org>
* from 4.2.6p3-RC12: Clean up m4 quoting in configure.ac, *.m4 files,
resolving intermittent AC_LANG_PROGRAM possibly undefined errors.
#include "ntp_stdlib.h"
#include "ntp_calendar.h"
-#include "ntp_assert.h"
-
/*
* Hacks to avoid excercising the multiplier. I have no pride.
*/
for (min = 1, idx = 0; idx < 3; idx++)
if (diff[idx] < diff[min])
min = idx;
- NTP_ENSURE(diff[min] <= NEARLIMIT);
-
- /* -*- store results and tell if we could get into CLOSETIME*/
- *ts_ui = test[min];
- *yearstart = ystt[min];
+ if (diff[min] <= NEARLIMIT) {
+ /* -*- store results and update year start */
+ *ts_ui = test[min];
+ *yearstart = ystt[min];
+ } else
+ *ts_ui = rec_ui; /* emergency fallback */
+
+ /* -*- tell if we could get into CLOSETIME*/
return diff[min] < CLOSETIME;
}