From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2124) id 1F8F5385B50C; Tue, 25 Jun 2024 10:58:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F8F5385B50C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1719313128; bh=0s9S15OI9lP71B7T8vIYMp5sk7Dvur9IvRshjj1Vk34=; h=From:To:Subject:Date:From; b=d8ZSBkMgO01pUex2W6LnhH83+H8DWMETAnt6p6Mo25hcsfQu4Yjc7pZ9ICGi9JF8d KCNo/3K4xJcHR2hwquOMn287MRZ0P6lFbM0WGlp2thD1DgYIBjLX8xNamToSb2naY5 tIaPYmoeuHIgqytMOImVKf+orCupZRa04XLiC2lE= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Clifton To: binutils-cvs@sourceware.org Subject: [binutils-gdb] Fix calculation of space remaining in buffer when printing the contents of a DST__K_RECBEG type debu X-Act-Checkin: binutils-gdb X-Git-Author: Nick Clifton X-Git-Refname: refs/heads/master X-Git-Oldrev: 2a56698523c840efa602aa7dbb70334c9074c177 X-Git-Newrev: 5ac806f22edad7f31098915f0545909e1f0ce6ff Message-Id: <20240625105848.1F8F5385B50C@sourceware.org> Date: Tue, 25 Jun 2024 10:58:48 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5ac806f22eda= d7f31098915f0545909e1f0ce6ff commit 5ac806f22edad7f31098915f0545909e1f0ce6ff Author: Nick Clifton 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. =20 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 =3D (void *)buf; - unsigned char *name =3D buf + sizeof (*recbeg); =20 if (len > sizeof (*recbeg)) { + unsigned char *name =3D buf + sizeof (*recbeg); int nlen =3D len - sizeof (*recbeg) - 1; + if (name[0] < nlen) nlen =3D name[0]; fprintf (file, _("recbeg: name: %.*s\n"), nlen, name + 1); + evax_bfd_print_valspec (buf, len, 4, file); - len -=3D 1 + nlen; + + len -=3D 1 + nlen + sizeof (*recbeg); if (len >=3D 4) fprintf (file, _(" len: %u bits\n"), (unsigned) bfd_getl32 (name + 1 + nlen));