From: Tom Tromey Date: Sun, 13 Aug 2023 16:37:00 +0000 (-0600) Subject: Remove alloca from osabi.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dad9ed2f252dc286d33e9e73d180eb348062e5dd;p=binutils-gdb.git Remove alloca from osabi.c I noticed that the call to alloca in osabi.c can be replaced with a statically-sized buffer, because some code just before the declaration ensures that the length is bounded. Reviewed-by: John Baldwin --- diff --git a/gdb/osabi.c b/gdb/osabi.c index d18802ac3a4..ad3dad5b849 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -463,7 +463,6 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, { const char *name; unsigned int sectsize; - char *note; name = bfd_section_name (sect); sectsize = bfd_section_size (sect); @@ -477,7 +476,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, compressed section. But, since note sections are not compressed, deferring the reading until we recognize the section avoids any error. */ - note = (char *) alloca (sectsize); + char note[MAX_NOTESZ]; /* .note.ABI-tag notes, used by GNU/Linux and FreeBSD. */ if (strcmp (name, ".note.ABI-tag") == 0)