]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
utils: fix a Y2038 bug by replacing Int32x32To64 with multiplication 61224/head
authorSilent <CookiePLMonster@users.noreply.github.com>
Fri, 3 Jan 2025 10:28:59 +0000 (11:28 +0100)
committerSilent <zdanio95@gmail.com>
Mon, 6 Jan 2025 18:41:27 +0000 (19:41 +0100)
Int32x32To64 macro internally truncates the arguments to int32,
while time_t is 64-bit on most/all modern platforms.
Therefore, usage of this macro creates a Year 2038 bug.

Signed-off-by: Adrian Zdanowicz <zdanio95@gmail.com>
src/dokan/utils.cc

index 576cceb9916e4a38cbb2ad3411017ce9eb55b8be..19046f85cc971f49cfed04497a957a6518a4f8f2 100644 (file)
@@ -15,7 +15,7 @@
 void to_filetime(time_t t, LPFILETIME pft)
 {
   // Note that LONGLONG is a 64-bit value
-  LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000;
+  LONGLONG ll = (t * 10000000LL) + 116444736000000000LL;
   pft->dwLowDateTime = (DWORD)ll;
   pft->dwHighDateTime = ll >> 32;
 }