From 4fdfd1f62a9d50298b0bb71e8bea04174af4a3ab Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 24 Jul 2019 13:36:50 +0200 Subject: Fix processing of tar mtime on 32 bit systems struct stat uses time_t to store time values. On some 32 bit systems, this may be a 32 bit integer. This patch adds a broken-out 64 bit time value to tar_header_decoded_t and makes sure to clamp the value to +/- (2^32 - 1) if required when writing it back to a struct stat. Reported-by: Matt Turner Signed-off-by: David Oberhollenzer --- include/tar.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/tar.h') diff --git a/include/tar.h b/include/tar.h index 5ac0763..e6a506a 100644 --- a/include/tar.h +++ b/include/tar.h @@ -74,6 +74,10 @@ typedef struct { uint64_t record_size; bool unknown_record; tar_xattr_t *xattr; + + /* broken out since struct stat could contain + 32 bit values on 32 bit systems. */ + int64_t mtime; } tar_header_decoded_t; #define TAR_TYPE_FILE '0' -- cgit v1.2.3