]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hexdump: Cast %ll argument to long long
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 18 Apr 2026 19:14:24 +0000 (21:14 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 18 Apr 2026 19:18:15 +0000 (21:18 +0200)
Cast off_t for F_ADDRESS to long long. In most cases, this should be
actually unsigned long long due to %llx or %llo, but since %lld is also
available and off_t is signed, keep it at that.

In theory, this might fix very intelligent static analysers which notice
that off_t is long int but %ll expects long long, but in reality, this
fixes 32 bit off_t builds. Without this, wrong addresses are shown.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
text-utils/hexdump-display.c

index d6422d24c64dfd3407e1be060f45f3ea6e95fb60..bff827db8273ceebb6b5e34f39fc02c530fc710e 100644 (file)
@@ -277,7 +277,7 @@ print(struct hexdump_pr *pr, unsigned char *bp) {
 
        switch(pr->flags) {
        case F_ADDRESS:
-               printf(pr->fmt, address);
+               printf(pr->fmt, (long long) address);
                break;
        case F_BPAD:
                printf(pr->fmt, "");