aboutsummaryrefslogtreecommitdiff
path: root/gdb/osabi.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-08-13 10:37:00 -0600
committerTom Tromey <tom@tromey.com>2023-08-14 14:12:29 -0600
commitdad9ed2f252dc286d33e9e73d180eb348062e5dd (patch)
tree3a4232a30ea032c79245623dc555cc583863c5ca /gdb/osabi.c
parente72b937dddaf24d99ec1bf3beda4d8ecf3cd368c (diff)
downloadgdb-dad9ed2f252dc286d33e9e73d180eb348062e5dd.zip
gdb-dad9ed2f252dc286d33e9e73d180eb348062e5dd.tar.gz
gdb-dad9ed2f252dc286d33e9e73d180eb348062e5dd.tar.bz2
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 <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/osabi.c')
-rw-r--r--gdb/osabi.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/osabi.c b/gdb/osabi.c
index d18802a..ad3dad5 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)