[PATCH] readelf: print_debug_macro_section clear vendor array before use.

Mark Wielaard mjw at redhat.com
Tue Jan 14 21:13:43 UTC 2014


Not setting a vendor code before use would be invalid which we tried to
catch. But to detect that we do need to initialize the vendor array to
zero first.

Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
 src/ChangeLog | 5 +++++
 src/readelf.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index d37cd1b..906f644 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-14  Mark Wielaard  <mjw at redhat.com>
+
+	* readelf.c (print_debug_macro_section): Clear vendor array before
+	use.
+
 2014-01-02  Mark Wielaard  <mjw at redhat.com>
 
 	* stack.c (show_raw): Declare unconditionally.
diff --git a/src/readelf.c b/src/readelf.c
index 739156c..3991224 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -6896,6 +6896,7 @@ print_debug_macro_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
 	}
 
       const unsigned char *vendor[DW_MACRO_GNU_hi_user - DW_MACRO_GNU_lo_user];
+      memset (vendor, 0, sizeof vendor);
       if (flag & 0x04)
 	{
 	  // 1 byte length, for each item, 1 byte opcode, uleb128 number
-- 
1.8.4.2



More information about the elfutils-devel mailing list