[binutils-gdb] PR31873, buffer overflow in evax_bfd_print_dst

Alan Modra amodra@sourceware.org
Mon Jun 10 13:31:27 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=539c3962fa08cfe46f71555f6b6d47326f3d9cda

commit 539c3962fa08cfe46f71555f6b6d47326f3d9cda
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Jun 10 22:50:26 2024 +0930

    PR31873, buffer overflow in evax_bfd_print_dst
    
            PR 31873
            * vms-alpha.c (evax_bfd_print_dst): Sanity check len against
            dst_size.

Diff:
---
 bfd/vms-alpha.c | 2 ++
 1 file changed, 2 insertions(+)

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);


More information about the Binutils-cvs mailing list