This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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@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@redhat.com>
+
+	* readelf.c (print_debug_macro_section): Clear vendor array before
+	use.
+
 2014-01-02  Mark Wielaard  <mjw@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]