public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* asan: buffer overflow in vms-alpha.c
@ 2022-02-16 11:31 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-02-16 11:31 UTC (permalink / raw)
  To: binutils

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

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:
 	  {

-- 
Alan Modra
Australia Development Lab, IBM

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

only message in thread, other threads:[~2022-02-16 11:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 11:31 asan: buffer overflow in vms-alpha.c 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).