From 3736ce3f559af88d675c63e3bef5b4e1a09b84ee Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Mon, 27 Sep 2010 13:19:25 +0000 Subject: [PATCH] hgfs: do not return negative file sizes in stat (reported by Antoine Leca) --- servers/hgfs/stat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/servers/hgfs/stat.c b/servers/hgfs/stat.c index a22b18c0f..df8c23d70 100644 --- a/servers/hgfs/stat.c +++ b/servers/hgfs/stat.c @@ -68,7 +68,10 @@ PUBLIC int do_stat() stat.st_uid = opt.uid; stat.st_gid = opt.gid; stat.st_rdev = NO_DEV; - stat.st_size = ex64hi(attr.a_size) ? ULONG_MAX : ex64lo(attr.a_size); + if (cmp64u(attr.a_size, LONG_MAX) > 0) + stat.st_size = LONG_MAX; + else + stat.st_size = ex64lo(attr.a_size); stat.st_atime = attr.a_atime; stat.st_mtime = attr.a_mtime; stat.st_ctime = attr.a_ctime; -- 2.44.0