]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
leapdb: add explicit cast to int64_t
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 25 Jul 2024 13:32:44 +0000 (15:32 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 30 Jul 2024 10:09:53 +0000 (12:09 +0200)
Add an explicit cast to int64_t to not rely on LEAP_SEC_LIST_OFFSET
not fitting in 32-bit time_t.

leapdb.c

index f6b059e8fd569499792baba57e5c54266b612fb4..e4b2f9f1fe4840378e006532ccdf6f183857c02e 100644 (file)
--- a/leapdb.c
+++ b/leapdb.c
@@ -122,7 +122,7 @@ get_list_leap(time_t when, int *tai_offset)
   when = (when / (24 * 3600) + 1) * (24 * 3600);
 
   /* leap-seconds.list timestamps are relative to 1 Jan 1900, 00:00:00 */
-  when1900 = when + LEAP_SEC_LIST_OFFSET;
+  when1900 = (int64_t)when + LEAP_SEC_LIST_OFFSET;
 
   while (fgets(line, sizeof line, f) > 0) {
     int64_t lsl_when;