summaryrefslogtreecommitdiffstats
path: root/src/unstrip.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2010-06-04 02:26:30 -0700
committerRoland McGrath <[email protected]>2010-06-14 12:52:09 -0700
commit3b1b651d89d14b948a7e2436efdbe89d9bf691c0 (patch)
treeb4d719614a723049574e59cbf8dedd213247ed10 /src/unstrip.c
parent827d4d176b989c5d765c7f349edff6f994f8ea78 (diff)
unstrip: Bail early on bogus invocation with reversed arguments.
Diffstat (limited to 'src/unstrip.c')
-rw-r--r--src/unstrip.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/unstrip.c b/src/unstrip.c
index 0984e6bc..755c42a3 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -1234,6 +1234,10 @@ copy_elided_sections (Elf *unstripped, Elf *stripped,
ELF_CHECK (elf_getshdrnum (stripped, &stripped_shnum) == 0,
_("cannot get section count: %s"));
+ if (unlikely (stripped_shnum > unstripped_shnum))
+ error (EXIT_FAILURE, 0, _("\
+more sections in stripped file than debug file -- arguments reversed?"));
+
/* Cache the stripped file's section details. */
struct section sections[stripped_shnum - 1];
Elf_Scn *scn = NULL;