PR31873, buffer overflow in evax_bfd_print_dst

Alan Modra amodra@gmail.com
Mon Jun 10 13:32:43 GMT 2024


	PR 31873
	* vms-alpha.c (evax_bfd_print_dst): Sanity check len against
	dst_size.

diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 404638cf3d9..337523015dc 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -7511,6 +7511,8 @@ evax_bfd_print_dst (struct bfd *abfd, unsigned int dst_size, FILE *file)
       /* xgettext:c-format */
       fprintf (file, _(" type: %3u, len: %3u (at 0x%08x): "),
 	       type, len, off);
+      if (len > dst_size)
+	len = dst_size;
       if (len < sizeof (dsth))
 	{
 	  fputc ('\n', file);

-- 
Alan Modra


More information about the Binutils mailing list