]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
reference: switch is_leap_close() from time_t to double
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 2 May 2024 11:20:54 +0000 (13:20 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 2 May 2024 12:43:46 +0000 (14:43 +0200)
Avoid undefined behavior in the timestamp conversion from double to
time_t in REF_IsLeapSecondClose() with NTP sources configured with a
large offset correction.

reference.c

index ffe290c98224e04cc539e1dbc05544d217c6af87..009d7c98b6803f41c616b0a349bf7c616b73bf6e 100644 (file)
@@ -1291,7 +1291,7 @@ REF_DisableLocal(void)
 #define LEAP_SECOND_CLOSE 5
 
 static int
-is_leap_close(time_t t)
+is_leap_close(double t)
 {
   return leap_when != 0 &&
          t >= leap_when - LEAP_SECOND_CLOSE && t < leap_when + LEAP_SECOND_CLOSE;