summaryrefslogtreecommitdiff
path: root/tar/tar2sqfs.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-15 02:31:26 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-15 02:31:54 +0100
commita8ae870667efc4051acdc323dc2a27293c82f600 (patch)
tree7be90edb0072b13895fc79244bb2e9a0bdbd3d69 /tar/tar2sqfs.c
parent724524cd401325120de9d96e6a1023c3561c8879 (diff)
Clamp mtime in tar2sqfs to the representable 32 bit range.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar/tar2sqfs.c')
-rw-r--r--tar/tar2sqfs.c8
1 files changed, 8 insertions, 0 deletions
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;