]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf.c (handle_versym): Initialize vername and filename array elements.
authorMark Wielaard <mjw@redhat.com>
Sat, 8 Nov 2014 13:04:27 +0000 (14:04 +0100)
committerMark Wielaard <mjw@redhat.com>
Sat, 8 Nov 2014 13:47:16 +0000 (14:47 +0100)
We check whether the elements are set before printing their contents,
but didn't make sure they were initialized.

Reported-by: Hanno Böck <hanno@hboeck.de>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/readelf.c

index 3ff3e311ae3c4e1e5fcf7d6843a029b5fdb268b4..6d3e9514a2616841ec90aed3ed0f6a3d212cba58 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-08  Mark Wielaard  <mjw@redhat.com>
+
+       * readelf.c (handle_versym): Initialize vername and filename array
+       elements.
+
 2014-11-07  Mark Wielaard  <mjw@redhat.com>
 
        * readelf.c (handle_sysv_hash): Sanity check section contents.
index e03a771d8802ddf09c49d8b7e1fe6dc6174541f8..01c644f2e69dd28146072920ffd00292e9ffc351 100644 (file)
@@ -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)