]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Try to continue after encountering bogus ELF Note data.
authorMark Wielaard <mark@klomp.org>
Mon, 18 Dec 2017 11:39:13 +0000 (12:39 +0100)
committerMark Wielaard <mark@klomp.org>
Mon, 18 Dec 2017 11:39:16 +0000 (12:39 +0100)
There might be other sections or segments with ELF Notes that are
readable. Also adjust error message depending on whether or not we
actually got any data for the ELF Note segment or section.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/readelf.c

index 8935022bea09504d2cced5f4474ced17b5714e78..994b1e17b748617666c0210b15c46aabfb1880c3 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-18  Mark Wielaard  <mark@klomp.org>
+
+       * readelf.c (handle_notes_data): Don't use EXIT_FAILURE in error.
+       Adjust error message depending on whether or not we got data.
+
 2017-12-07  Mark Wielaard  <mark@klomp.org>
 
        * readelf.c (print_ops): Update data pointer and print arguments
index ed21ef7acbe0a04aabb9479f9d7190207b00f188..ca979e3c6405c16dee78eb5b4db8d34fafd56bdc 100644 (file)
@@ -9611,9 +9611,9 @@ handle_notes_data (Ebl *ebl, const GElf_Ehdr *ehdr,
     return;
 
  bad_note:
-  error (EXIT_FAILURE, 0,
-        gettext ("cannot get content of note section: %s"),
-        elf_errmsg (-1));
+  error (0, 0,
+        gettext ("cannot get content of note: %s"),
+        data != NULL ? "garbage data" : elf_errmsg (-1));
 }
 
 static void