1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

vfs_gpfs: Protect against timestamps before the Unix epoch

In addition to b954d181cd2 we should also protect against timestamps
before the epoch.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15151
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Sep 23 06:50:17 UTC 2022 on sn-devel-184

(cherry picked from commit f6b391e04a4d5974b908f4f375bd2876083aa7b2)
This commit is contained in:
Volker Lendecke 2022-08-22 15:24:01 +02:00 committed by Jule Anger
parent 9364c930fb
commit ecf8a66e0c

View File

@ -1679,10 +1679,10 @@ static int timespec_to_gpfs_time(
return 0;
}
if (ts.tv_sec > UINT32_MAX) {
DBG_WARNING("GPFS uses 32-bit unsigned timestamps, "
"%ju is too large\n",
(uintmax_t)ts.tv_sec);
if (ts.tv_sec < 0 || ts.tv_sec > UINT32_MAX) {
DBG_NOTICE("GPFS uses 32-bit unsigned timestamps "
"and cannot handle %jd.\n",
(intmax_t)ts.tv_sec);
errno = ERANGE;
return -1;
}