From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 726203858403; Mon, 10 Jun 2024 13:31:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 726203858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1718026287; bh=zqawGFeSNqoDkWUuPIl6uDWMcobeqJjzs/3/zY8QIEI=; h=From:To:Subject:Date:From; b=MRIoTQkVumf4dz8U3+9Ppxdo8q9XprxL/w4R/Nx7DpQoyFpLab0j+qHPFss8rjvtv GpcRui8c2uUmboQ+Mbzx0/WzxFOWkmYXLv+6z1efMnLEQ+FpAyCYrBLlGGw/y/SJp5 pVv6E8+AAwh84VFfVxGjp7TarvB4yUgce7j8NL0g= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: binutils-cvs@sourceware.org Subject: [binutils-gdb] PR31873, buffer overflow in evax_bfd_print_dst X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 0949bd1df959bbdb249ae634bd38a899cd36df10 X-Git-Newrev: 539c3962fa08cfe46f71555f6b6d47326f3d9cda Message-Id: <20240610133127.726203858403@sourceware.org> Date: Mon, 10 Jun 2024 13:31:27 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D539c3962fa08= cfe46f71555f6b6d47326f3d9cda commit 539c3962fa08cfe46f71555f6b6d47326f3d9cda Author: Alan Modra Date: Mon Jun 10 22:50:26 2024 +0930 PR31873, buffer overflow in evax_bfd_print_dst =20 PR 31873 * vms-alpha.c (evax_bfd_print_dst): Sanity check len against dst_size. Diff: --- bfd/vms-alpha.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 404638cf3d9..337523015dc 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -7511,6 +7511,8 @@ evax_bfd_print_dst (struct bfd *abfd, unsigned int ds= t_size, FILE *file) /* xgettext:c-format */ fprintf (file, _(" type: %3u, len: %3u (at 0x%08x): "), type, len, off); + if (len > dst_size) + len =3D dst_size; if (len < sizeof (dsth)) { fputc ('\n', file);