[binutils-gdb] asan: buffer overflow in vms-alpha.c

Alan Modra amodra@sourceware.org
Wed Feb 16 11:35:44 GMT 2022


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

commit 6e731729881ae4c1a9542843c29a3981166c9e45
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Feb 15 16:04:34 2022 +1030

    asan: buffer overflow in vms-alpha.c
    
            * vms-alpha.c (evax_bfd_print_dst): Sanity check another place
            printing strings.

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

diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index c8250e2a673..06fa891ac70 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -7390,7 +7390,9 @@ evax_bfd_print_dst (struct bfd *abfd, unsigned int dst_size, FILE *file)
 	  fprintf (file, _("standard data: %s\n"),
 		   evax_bfd_get_dsc_name (type));
 	  evax_bfd_print_valspec (buf, len, 4, file);
-	  fprintf (file, _("    name: %.*s\n"), buf[5], buf + 6);
+	  if (len > 6)
+	    fprintf (file, _("    name: %.*s\n"),
+		     buf[5] > len - 6 ? len - 6 : buf[5], buf + 6);
 	  break;
 	case DST__K_MODBEG:
 	  {


More information about the Binutils-cvs mailing list