From: Silent Date: Fri, 3 Jan 2025 10:28:59 +0000 (+0100) Subject: utils: fix a Y2038 bug by replacing Int32x32To64 with multiplication X-Git-Tag: v20.3.0~413^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e0b22e94f041719b8e2d005362fad80df99762f8;p=ceph.git 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 --- diff --git a/src/dokan/utils.cc b/src/dokan/utils.cc index 576cceb9916e..19046f85cc97 100644 --- a/src/dokan/utils.cc +++ b/src/dokan/utils.cc @@ -15,7 +15,7 @@ void to_filetime(time_t t, LPFILETIME pft) { // Note that LONGLONG is a 64-bit value - LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000; + LONGLONG ll = (t * 10000000LL) + 116444736000000000LL; pft->dwLowDateTime = (DWORD)ll; pft->dwHighDateTime = ll >> 32; }