summaryrefslogtreecommitdiff
path: root/lib/tar/internal.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-03 17:51:06 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-03 18:28:09 +0200
commitc6d289ab9e604369c25ed2c766842318f74e9256 (patch)
tree9782addc35fcb9c9f85f9c1e7ac79bacbcdb4843 /lib/tar/internal.h
parent4c053b734cc6645ee75a11dd323bd777165d4782 (diff)
Fix integer bounds checking in GNU tar sparse format 1.0 parser
- Make sure the file actually has that many records before trying to read one and fail if not. - Use the helper macros for size_t overflow checking instead of assuming size_t == uint64_t. - Impose a "reasonable" upper bound on the number of data segments and insist that there is at least one entry. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/tar/internal.h')
-rw-r--r--lib/tar/internal.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/tar/internal.h b/lib/tar/internal.h
index 65e5d45..bea863d 100644
--- a/lib/tar/internal.h
+++ b/lib/tar/internal.h
@@ -42,6 +42,7 @@ enum {
#define TAR_MAX_SYMLINK_LEN (65536)
#define TAR_MAX_PATH_LEN (65536)
#define TAR_MAX_PAX_LEN (65536)
+#define TAR_MAX_SPARSE_ENT (65536)
int read_octal(const char *str, int digits, sqfs_u64 *out);