]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Define dyn_mem outside the while loop.
authorMark Wielaard <mark@klomp.org>
Tue, 19 Apr 2022 09:25:42 +0000 (11:25 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 19 Apr 2022 09:25:42 +0000 (11:25 +0200)
The GCC address sanitizer might complain otherwise:
stack-use-after-scope src/readelf.c:1787 in get_dyn_ents

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/readelf.c

index f563e993ab7555a31bddaf8c16b6d3a9b845787e..6ef81862db2cacfa452bcdc12367df6e2c215380 100644 (file)
@@ -1,3 +1,7 @@
+2022-04-19  Mark Wielaard  <mark@klomp.org>
+
+       * readelf.c (get_dyn_ents): Define dyn_mem outside the while loop.
+
 2022-03-01  Di Chen  <dichen@redhat.com>
 
        * readelf.c (get_dyn_ents): New function.
index 4b275ecedbf166417bb9bc48ba9d802d1bc959a0..4b6aab2b90523edf222f8c4de296f7121af56f09 100644 (file)
@@ -1776,10 +1776,10 @@ static size_t
 get_dyn_ents (Elf_Data * dyn_data)
 {
   GElf_Dyn *dyn;
+  GElf_Dyn dyn_mem;
   size_t dyn_idx = 0;
   do
     {
-      GElf_Dyn dyn_mem;
       dyn = gelf_getdyn(dyn_data, dyn_idx, &dyn_mem);
       if (dyn != NULL)
        ++dyn_idx;