1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Fix Y2038 bug on Windows in unreal_setfilemodtime (PR #332)

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.
This commit is contained in:
Silent
2026-01-11 07:33:49 +01:00
committed by GitHub
parent 1c461db46d
commit 275f04c76c
+1 -1
View File
@@ -1123,7 +1123,7 @@ void unreal_setfilemodtime(const char *filename, time_t mtime)
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return;
llValue = Int32x32To64(mtime, 10000000) + 116444736000000000;
llValue = (mtime * 10000000LL) + 116444736000000000LL;
mTime.dwLowDateTime = (long)llValue;
mTime.dwHighDateTime = llValue >> 32;