aboutsummaryrefslogtreecommitdiff
path: root/bfd/vms-alpha.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-06-10 22:50:26 +0930
committerAlan Modra <amodra@gmail.com>2024-06-10 22:53:11 +0930
commit539c3962fa08cfe46f71555f6b6d47326f3d9cda (patch)
treed930c0e26c16177ac5248bef7486c7fa6cccc071 /bfd/vms-alpha.c
parent0949bd1df959bbdb249ae634bd38a899cd36df10 (diff)
downloadgdb-539c3962fa08cfe46f71555f6b6d47326f3d9cda.zip
gdb-539c3962fa08cfe46f71555f6b6d47326f3d9cda.tar.gz
gdb-539c3962fa08cfe46f71555f6b6d47326f3d9cda.tar.bz2
PR31873, buffer overflow in evax_bfd_print_dst
PR 31873 * vms-alpha.c (evax_bfd_print_dst): Sanity check len against dst_size.
Diffstat (limited to 'bfd/vms-alpha.c')
-rw-r--r--bfd/vms-alpha.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 404638c..3375230 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);