Sanity check SHT_MIPS_OPTIONS size

* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Use
	bfd_malloc_and_get_section to read contents of .MIPS.options.
This commit is contained in:
Alan Modra
2022-11-11 09:52:43 +10:30
parent 772e1fe54a
commit d0e5049d8f

View File

@ -7523,11 +7523,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
{ {
bfd_byte *contents, *l, *lend; bfd_byte *contents, *l, *lend;
contents = bfd_malloc (hdr->sh_size); if (!bfd_malloc_and_get_section (abfd, hdr->bfd_section, &contents))
if (contents == NULL)
return false;
if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents,
0, hdr->sh_size))
{ {
free (contents); free (contents);
return false; return false;