public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* buffer overflow in print_symname
@ 2023-04-19 23:05 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-04-19 23:05 UTC (permalink / raw)
  To: binutils

	* ecoff.c (_bfd_ecoff_slurp_symbolic_info): Zero terminate
	string sections.

diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index fb6fcade913..676b8d84017 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -599,6 +599,12 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd,
   FIX (cbExtOffset, iextMax, external_ext, void *);
 #undef FIX
 
+  /* Ensure string sections are zero terminated.  */
+  if (debug->ss)
+    debug->ss[internal_symhdr->issMax - 1] = 0;
+  if (debug->ssext)
+    debug->ssext[internal_symhdr->issExtMax - 1] = 0;
+
   /* I don't want to always swap all the data, because it will just
      waste time and most programs will never look at it.  The only
      time the linker needs most of the debugging information swapped

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-19 23:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 23:05 buffer overflow in print_symname 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).