From: Alan Modra Date: Mon, 10 Jun 2024 13:20:26 +0000 (+0930) Subject: PR31873, buffer overflow in evax_bfd_print_dst X-Git-Tag: binutils-2_43~464 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=539c3962fa08cfe46f71555f6b6d47326f3d9cda;p=thirdparty%2Fbinutils-gdb.git PR31873, buffer overflow in evax_bfd_print_dst PR 31873 * vms-alpha.c (evax_bfd_print_dst): Sanity check len against dst_size. --- 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 dst_size, FILE *file) /* xgettext:c-format */ fprintf (file, _(" type: %3u, len: %3u (at 0x%08x): "), type, len, off); + if (len > dst_size) + len = dst_size; if (len < sizeof (dsth)) { fputc ('\n', file);