]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Use section_name instead of elf_strptr in print_debug_frame_section
authorMark Wielaard <mark@klomp.org>
Thu, 27 Feb 2025 20:22:49 +0000 (21:22 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 27 Feb 2025 20:23:01 +0000 (21:23 +0100)
All other print_debug_* functions use section_name (ebl, shdr) to get
the current section name. Be consistent and use the same method in
print_debug_frame_section to make static analyzers happy who might
think elf_strptr can return NULL in this case.

      * src/readelf.c (print_debug_frame_section): Use section_name
      instead of elf_strptr to get the section name.

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

index 61d5b71a79132a8bc78c401fe04be48a6ae860b7..c9aebd5b3e5f8b1a9de043a830abeb6f86d04d84 100644 (file)
@@ -7170,7 +7170,7 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
   size_t shstrndx;
   /* We know this call will succeed since it did in the caller.  */
   (void) elf_getshdrstrndx (ebl->elf, &shstrndx);
-  const char *scnname = elf_strptr (ebl->elf, shstrndx, shdr->sh_name);
+  const char *scnname = section_name (ebl, shdr);
 
   /* Needed if we find PC-relative addresses.  */
   GElf_Addr bias;