From: Mark Wielaard Date: Sat, 8 Nov 2014 13:04:27 +0000 (+0100) Subject: readelf.c (handle_versym): Initialize vername and filename array elements. X-Git-Tag: elfutils-0.161~98 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d8b9682b1a5ff2746f172487eaf19ebd088bb7f4;p=thirdparty%2Felfutils.git readelf.c (handle_versym): Initialize vername and filename array elements. 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 --- diff --git a/src/ChangeLog b/src/ChangeLog index 3ff3e311a..6d3e9514a 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 e03a771d8..01c644f2e 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)