]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1735] clocktime() aborts ntpd on bogus input: changed to regular error indication
authorJuergen Perlinger <perlinger@ntp.org>
Wed, 1 Dec 2010 22:05:13 +0000 (23:05 +0100)
committerJuergen Perlinger <perlinger@ntp.org>
Wed, 1 Dec 2010 22:05:13 +0000 (23:05 +0100)
bk: 4cf6c699yWL8awPoQYh_7_VrwwV8wA

ChangeLog
libntp/clocktime.c

index 46bfaf014ae9bcfa3721142dbb087cba8dcb683a..fa1fb8e0c598657308b5ce93efa86a668339892e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [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.
index 070672a2c2e5c76bce5bf0de6b1326d1b650844c..2781c68008e686c6f464f25950e5659698936288 100644 (file)
@@ -8,8 +8,6 @@
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
 
-#include "ntp_assert.h"
-
 /*
  * Hacks to avoid excercising the multiplier.  I have no pride.
  */
@@ -136,11 +134,14 @@ clocktime(
        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;
 }