From 5d4465be2b2acacb5e56064c2ffcd329a3f31b58 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 28 May 2025 15:12:39 +0930 Subject: [PATCH] PR 33021, buffer overflow in write_dwarf_eh_frame_hdr * elf-eh-frame.c (write_dwarf_eh_frame_hdr): Use size of contents, not section size, in bfd_set_section_contents call. --- bfd/elf-eh-frame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 78b3ecb5a7d..0250a8f8d11 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -2506,7 +2506,7 @@ write_dwarf_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) /* FIXME: octets_per_byte. */ if (!bfd_set_section_contents (abfd, sec->output_section, contents, (file_ptr) sec->output_offset, - sec->size)) + size)) retval = false; out: free (contents); -- 2.47.3