diff options
author | Nick Clifton <nickc@redhat.com> | 2024-06-25 11:56:38 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2024-06-25 11:56:38 +0100 |
commit | 5ac806f22edad7f31098915f0545909e1f0ce6ff (patch) | |
tree | ad8351ff7f71d7e746ec8491e071a38970d7ef7d | |
parent | 2a56698523c840efa602aa7dbb70334c9074c177 (diff) | |
download | gdb-5ac806f22edad7f31098915f0545909e1f0ce6ff.zip gdb-5ac806f22edad7f31098915f0545909e1f0ce6ff.tar.gz gdb-5ac806f22edad7f31098915f0545909e1f0ce6ff.tar.bz2 |
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
-rw-r--r-- | bfd/vms-alpha.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 3375230..a53ccdf 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)); |