From a29e6d252ad1bc82c0990d1bac72d0083ab708b8 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 6 Jul 2026 22:32:31 -0500 Subject: [PATCH] sh_flags wasn't big enough (found by eglonnnn) and a few cleanups while I was there. --- toys/other/readelf.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/toys/other/readelf.c b/toys/other/readelf.c index 26b53180..9bc93dba 100644 --- a/toys/other/readelf.c +++ b/toys/other/readelf.c @@ -88,8 +88,8 @@ static unsigned short elf_short(char **p) static int fits(char *what, int n, unsigned long long off, unsigned long long size) { if (off > TT.size || size > TT.size || off > TT.size-size) { - if (n == -1) *toybuf = 0; - else snprintf(toybuf, sizeof(toybuf), " %d", n); + *toybuf = 0; + if (n != -1) sprintf(toybuf, " %d", n); printf("%s%s's offset %llu + size %llu > file size %llu\n", what, toybuf, off, size, TT.size); return 0; @@ -454,6 +454,16 @@ static void show_notes(unsigned long offset, unsigned long size) } } +static void do_flag(int shift, long long *flags, char **out, char c) +{ + long long bit = 1<