From: Mark Wielaard Date: Tue, 19 Apr 2022 09:25:42 +0000 (+0200) Subject: readelf: Define dyn_mem outside the while loop. X-Git-Tag: elfutils-0.187~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21fa92319657ca479ae108967fd41ac523a2f876;p=thirdparty%2Felfutils.git readelf: Define dyn_mem outside the while loop. The GCC address sanitizer might complain otherwise: stack-use-after-scope src/readelf.c:1787 in get_dyn_ents Signed-off-by: Mark Wielaard --- diff --git a/src/ChangeLog b/src/ChangeLog index f563e993a..6ef81862d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2022-04-19 Mark Wielaard + + * readelf.c (get_dyn_ents): Define dyn_mem outside the while loop. + 2022-03-01 Di Chen * readelf.c (get_dyn_ents): New function. diff --git a/src/readelf.c b/src/readelf.c index 4b275eced..4b6aab2b9 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -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;