From a8ae870667efc4051acdc323dc2a27293c82f600 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 15 Dec 2019 02:31:26 +0100 Subject: Clamp mtime in tar2sqfs to the representable 32 bit range. Signed-off-by: David Oberhollenzer --- tar/tar2sqfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 6be682f..cca604a 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -423,6 +423,14 @@ static int process_tar_ball(void) if (ret < 0) return -1; + if (hdr.mtime < 0) + hdr.mtime = 0; + + if ((sqfs_u64)hdr.mtime > 0x0FFFFFFFFUL) + hdr.mtime = 0x0FFFFFFFFUL; + + hdr.sb.st_mtime = hdr.mtime; + skip = false; is_root = false; is_prefixed = true; -- cgit v1.2.3