Skip to content

Commit e0b22e9

Browse files
utils: 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. Signed-off-by: Adrian Zdanowicz <[email protected]>
1 parent 6fd292f commit e0b22e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dokan/utils.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
void to_filetime(time_t t, LPFILETIME pft)
1616
{
1717
// Note that LONGLONG is a 64-bit value
18-
LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000;
18+
LONGLONG ll = (t * 10000000LL) + 116444736000000000LL;
1919
pft->dwLowDateTime = (DWORD)ll;
2020
pft->dwHighDateTime = ll >> 32;
2121
}

0 commit comments

Comments
 (0)