mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
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>
This commit is contained in:
parent
e72b937ddd
commit
dad9ed2f25
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user