aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-07-09 18:06:53 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-07-09 18:14:01 +0200
commit531d77736ece1398be75cf9b191a06b2e51f6304 (patch)
tree4dc173cebd2318a9623067f042920c017aba2a1e /lib
parentc37f0087c50c8b0568e8fc7aa69d50eea65fd08b (diff)
Fix printf format specifiers used for generating tarballs
When processing files > 4G, using "%o" truncates the result and the tarball is not readable. This should have been discovered when auto-patching the printf format specifiers, but a cast was added instead and the issue was overlooked. This commit replaces the down-cast and printf format specifiers. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/tar/write_header.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/tar/write_header.c b/lib/tar/write_header.c
index 3caa1b3..a337b74 100644
--- a/lib/tar/write_header.c
+++ b/lib/tar/write_header.c
@@ -31,10 +31,10 @@ static void write_number(char *dst, sqfs_u64 value, int digits)
mask = (mask << 3) | 7;
if (value <= mask) {
- sprintf(buffer, "%0*o ", digits - 1, (unsigned int)value);
+ sprintf(buffer, "%0*lo ", digits - 1, (unsigned long)value);
memcpy(dst, buffer, digits);
} else if (value <= ((mask << 3) | 7)) {
- sprintf(buffer, "%0*o", digits, (unsigned int)value);
+ sprintf(buffer, "%0*lo", digits, (unsigned long)value);
memcpy(dst, buffer, digits);
} else {
write_binary(dst, value, digits);