aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-03-12 18:08:24 -0700
committerRob Landley <rob@landley.net>2020-03-13 00:49:31 -0500
commitf1142e5b6d86eb918bd0176b28544e6110bc9e2f (patch)
tree0cd70d030bf7bcafd71215259acd6bb5ea2c8583
parent1a2449aa37baf27d61c4232545e90570c42f2e3b (diff)
downloadtoybox-f1142e5b6d86eb918bd0176b28544e6110bc9e2f.tar.gz
readelf: fix interpreter name length check.
Looks like I left off half way through this! Also default readelf to n while it's still in pending.
-rw-r--r--toys/pending/readelf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/pending/readelf.c b/toys/pending/readelf.c
index ef888c07..5cd148c1 100644
--- a/toys/pending/readelf.c
+++ b/toys/pending/readelf.c
@@ -8,7 +8,7 @@ USE_READELF(NEWTOY(readelf, "<1(dyn-syms)adehlnp:SsWx:", TOYFLAG_USR|TOYFLAG_BIN
config READELF
bool "readelf"
- default y
+ default n
help
usage: readelf [-adehlnSs] [-p SECTION] [-x SECTION] [file...]
@@ -458,7 +458,7 @@ static void scan_elf()
ph_type(ph.type), ph.offset, w, ph.vaddr, w, ph.paddr,
ph.filesz, ph.memsz, ph.flags&4?'R':' ', ph.flags&2?'W':' ',
ph.flags&1?'E':' ', ph.align);
- if (ph.type == 3 /*PH_INTERP*/ && ph.filesz && ph.filesz) {
+ if (ph.type == 3 /*PH_INTERP*/ && ph.filesz - 1 < TT.size - ph.offset) {
printf(" [Requesting program interpreter: %*s]\n",
(int) ph.filesz-1, TT.elf+ph.offset);
}