aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-11-11 09:52:43 +1030
committerAlan Modra <amodra@gmail.com>2022-11-11 18:05:36 +1030
commitd0e5049d8fa8e1994a42bb0296f72cc981b8ce8c (patch)
tree5eb90e5c9e53238a232c60778e7979ea44d7cb36 /bfd
parent772e1fe54a43adb1bf282f5cc599862df7b68317 (diff)
downloadgdb-d0e5049d8fa8e1994a42bb0296f72cc981b8ce8c.zip
gdb-d0e5049d8fa8e1994a42bb0296f72cc981b8ce8c.tar.gz
gdb-d0e5049d8fa8e1994a42bb0296f72cc981b8ce8c.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elfxx-mips.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index e0e2392..932167c 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7523,11 +7523,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
{
bfd_byte *contents, *l, *lend;
- contents = bfd_malloc (hdr->sh_size);
- if (contents == NULL)
- return false;
- if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents,
- 0, hdr->sh_size))
+ if (!bfd_malloc_and_get_section (abfd, hdr->bfd_section, &contents))
{
free (contents);
return false;