Skip to content

Commit 02137dd

Browse files
CookiePLMonsterselvanair
authored andcommitted
Fix a Y2038 bug by replacing Int32x32To64 with regular 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.
1 parent 3ba02de commit 02137dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

localization.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ LocalizedTime(const time_t t, LPTSTR buf, size_t size)
189189
/* Convert Unix timestamp to Win32 SYSTEMTIME */
190190
FILETIME lft;
191191
SYSTEMTIME st;
192-
LONGLONG tmp = Int32x32To64(t, 10000000) + 116444736000000000;
192+
LONGLONG tmp = (t * 10000000LL) + 116444736000000000LL;
193193
FILETIME ft = { .dwLowDateTime = (DWORD) tmp, .dwHighDateTime = tmp >> 32};
194194
FileTimeToLocalFileTime(&ft, &lft);
195195
FileTimeToSystemTime(&lft, &st);

0 commit comments

Comments
 (0)