public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Fix calculation of space remaining in buffer when printing the contents of a DST__K_RECBEG type debu
@ 2024-06-25 10:58 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2024-06-25 10:58 UTC (permalink / raw)
  To: binutils-cvs

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

commit 5ac806f22edad7f31098915f0545909e1f0ce6ff
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Jun 25 11:56:38 2024 +0100

    Fix calculation of space remaining in buffer when printing the contents of a DST__K_RECBEG type debug symbol for the VMS Alpha port.
    
      PR 31873

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

diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 337523015dc..a53ccdf4eb9 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -7721,16 +7721,19 @@ evax_bfd_print_dst (struct bfd *abfd, unsigned int dst_size, FILE *file)
 	case DST__K_RECBEG:
 	  {
 	    struct vms_dst_recbeg *recbeg = (void *)buf;
-	    unsigned char *name = buf + sizeof (*recbeg);
 
 	    if (len > sizeof (*recbeg))
 	      {
+		unsigned char *name = buf + sizeof (*recbeg);
 		int nlen = len - sizeof (*recbeg) - 1;
+
 		if (name[0] < nlen)
 		  nlen = name[0];
 		fprintf (file, _("recbeg: name: %.*s\n"), nlen, name + 1);
+
 		evax_bfd_print_valspec (buf, len, 4, file);
-		len -= 1 + nlen;
+
+		len -= 1 + nlen + sizeof (*recbeg);
 		if (len >= 4)
 		  fprintf (file, _("    len: %u bits\n"),
 			   (unsigned) bfd_getl32 (name + 1 + nlen));

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

only message in thread, other threads:[~2024-06-25 10:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 10:58 [binutils-gdb] Fix calculation of space remaining in buffer when printing the contents of a DST__K_RECBEG type debu Nick Clifton

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