aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-04-04 12:50:17 +1030
committerAlan Modra <amodra@gmail.com>2024-04-04 13:19:42 +1030
commit0ab0435fe672b76f0efb8814594b65c8e968d983 (patch)
treed1521c5cf6c46a91a0ae4718b47a7a960d38c18b /bfd
parent9fd82d9142d742c9e3efb16466019bd5fe86aef9 (diff)
downloadgdb-0ab0435fe672b76f0efb8814594b65c8e968d983.zip
gdb-0ab0435fe672b76f0efb8814594b65c8e968d983.tar.gz
gdb-0ab0435fe672b76f0efb8814594b65c8e968d983.tar.bz2
Re: USE_MMAP fuzzed object file attacks
I committed a broken patch. * aoutx.h (aout_get_external_symbols): Remove wrong #else and unneeded casts. * pdp11.c (aout_get_external_symbols): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/aoutx.h7
-rw-r--r--bfd/pdp11.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index fb6326d..d98ba61 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1322,21 +1322,20 @@ aout_get_external_symbols (bfd *abfd)
if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
&obj_aout_sym_window (abfd), true))
return false;
- syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
+ syms = obj_aout_sym_window (abfd).data;
}
else
-#else
+#endif
{
/* We allocate using malloc to make the values easy to free
later on. If we put them on the objalloc it might not be
possible to free them. */
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
return false;
- syms = (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt);
+ syms = _bfd_malloc_and_read (abfd, amt, amt);
if (syms == NULL)
return false;
}
-#endif
obj_aout_external_syms (abfd) = syms;
obj_aout_external_sym_count (abfd) = count;
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index f9ded64..b20c396 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1299,21 +1299,20 @@ aout_get_external_symbols (bfd *abfd)
if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
&obj_aout_sym_window (abfd), true))
return false;
- syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
+ syms = obj_aout_sym_window (abfd).data;
}
else
-#else
+#endif
{
/* We allocate using malloc to make the values easy to free
later on. If we put them on the objalloc it might not be
possible to free them. */
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
return false;
- syms = (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt);
+ syms = _bfd_malloc_and_read (abfd, amt, amt);
if (syms == NULL)
return false;
}
-#endif
obj_aout_external_syms (abfd) = syms;
obj_aout_external_sym_count (abfd) = count;