asan: buffer overflow in vms-alpha.c
authorAlan Modra <amodra@gmail.com>
Tue, 15 Feb 2022 05:34:34 +0000 (16:04 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 16 Feb 2022 08:45:40 +0000 (19:15 +1030)
* vms-alpha.c (evax_bfd_print_dst): Sanity check another place
printing strings.

bfd/vms-alpha.c

index c8250e2a673f5319db3f020f2620e12c192ef29f..06fa891ac7018fb678a70ce19b9151f336d63a0e 100644 (file)
@@ -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:
          {