From: Nick Clifton Date: Tue, 25 Jun 2024 10:56:38 +0000 (+0100) Subject: Fix calculation of space remaining in buffer when printing the contents of a DST__K_R... X-Git-Tag: binutils-2_43~286 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ac806f22edad7f31098915f0545909e1f0ce6ff;p=thirdparty%2Fbinutils-gdb.git 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 --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));