* Sanity check SHT_MIPS_OPTIONS size
@ 2022-11-11 7:33 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-11-11 7:33 UTC (permalink / raw)
To: binutils
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Use
bfd_malloc_and_get_section to read contents of .MIPS.options.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index e0e23926f03..932167c15c6 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;
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-11 7:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 7:33 Sanity check SHT_MIPS_OPTIONS size Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).