summaryrefslogtreecommitdiff
path: root/usr.bin/ctfdump
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-08-10 07:58:05 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-08-10 07:58:05 +0000
commit17a3a0fbd7c362d6fdb294e83f9660db1579614b (patch)
treee8faea8795a4833784a0cdf9b4dc088153dd3acc /usr.bin/ctfdump
parentf8a7155a14ccf633fb5670278326f595dfa36af3 (diff)
Fix two compiler warnings resulting from last zlib bump
total_out is now an unsigned long, so a format string warning is issued on all architectures. Fix this and also fix the format string for the off_t len, which is signed, not unsigned. Comparing an unsigned long to an off_t involves implementation-defined behavior for values > LONG_MAX on 64-bit architectures, so the compiler complains. Fix this by checking that len >= 0 and then casting both sides to a wider type. reported by and ok deraadt
Diffstat (limited to 'usr.bin/ctfdump')
-rw-r--r--usr.bin/ctfdump/ctfdump.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ctfdump/ctfdump.c b/usr.bin/ctfdump/ctfdump.c
index 945cfc88a81..62d7a13b988 100644
--- a/usr.bin/ctfdump/ctfdump.c
+++ b/usr.bin/ctfdump/ctfdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctfdump.c,v 1.25 2022/02/10 23:40:09 bluhm Exp $ */
+/* $OpenBSD: ctfdump.c,v 1.26 2022/08/10 07:58:04 tb Exp $ */
/*
* Copyright (c) 2016 Martin Pieuchot <mpi@openbsd.org>
@@ -699,8 +699,8 @@ decompress(const char *buf, size_t size, off_t len)
goto exit;
}
- if (stream.total_out != len) {
- warnx("decompression failed: %llu != %llu",
+ if (len < 0 || (uintmax_t)stream.total_out != (uintmax_t)len) {
+ warnx("decompression failed: %lu != %lld",
stream.total_out, len);
goto exit;
}