Skip to content

Commit 302c861

Browse files
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.
1 parent 9994933 commit 302c861

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

syscall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ int do_SetFileTime(const char *path, time_t crtime)
480480
free(pathw);
481481
if (handle == INVALID_HANDLE_VALUE)
482482
return -1;
483-
int64 temp_time = Int32x32To64(crtime, 10000000) + 116444736000000000LL;
483+
int64 temp_time = (crtime * 10000000LL) + 116444736000000000LL;
484484
FILETIME birth_time;
485485
birth_time.dwLowDateTime = (DWORD)temp_time;
486486
birth_time.dwHighDateTime = (DWORD)(temp_time >> 32);

0 commit comments

Comments
 (0)