From 4ce604114a80b1a7ce5580bbebffbfaa6df84bfb Mon Sep 17 00:00:00 2001
From: Silent <zdanio95@gmail.com>
Date: Mon, 13 Jan 2025 15:01:06 +0100
Subject: [PATCH 02/43] syscall: fix a Y2038 bug by replacing Int32x32To64 with
 multiplication

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.
---
 syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/syscall.c b/syscall.c
index 34a9bba0..604cebe2 100644
--- a/syscall.c
+++ b/syscall.c
@@ -480,7 +480,7 @@ int do_SetFileTime(const char *path, time_t crtime)
 	free(pathw);
 	if (handle == INVALID_HANDLE_VALUE)
 	    return -1;
-	int64 temp_time = Int32x32To64(crtime, 10000000) + 116444736000000000LL;
+	int64 temp_time = (crtime * 10000000LL) + 116444736000000000LL;
 	FILETIME birth_time;
 	birth_time.dwLowDateTime = (DWORD)temp_time;
 	birth_time.dwHighDateTime = (DWORD)(temp_time >> 32);
-- 
2.51.0

