>From d8b9682b1a5ff2746f172487eaf19ebd088bb7f4 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 8 Nov 2014 14:04:27 +0100 Subject: [PATCH 2/2] readelf.c (handle_versym): Initialize vername and filename array elements. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We check whether the elements are set before printing their contents, but didn't make sure they were initialized. Reported-by: Hanno Böck Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 +++++ src/readelf.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 3ff3e31..6d3e951 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-11-08 Mark Wielaard + + * readelf.c (handle_versym): Initialize vername and filename array + elements. + 2014-11-07 Mark Wielaard * readelf.c (handle_sysv_hash): Sanity check section contents. diff --git a/src/readelf.c b/src/readelf.c index e03a771..01c644f 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -2716,7 +2716,9 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) /* Allocate the array. */ vername = (const char **) alloca (nvername * sizeof (const char *)); + memset(vername, 0, nvername * sizeof (const char *)); filename = (const char **) alloca (nvername * sizeof (const char *)); + memset(filename, 0, nvername * sizeof (const char *)); /* Run through the data structures again and collect the strings. */ if (defscn != NULL) -- 1.9.3