From: Alan Modra Date: Wed, 28 May 2025 05:42:39 +0000 (+0930) Subject: PR 33021, buffer overflow in write_dwarf_eh_frame_hdr X-Git-Tag: binutils-2_45~477 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d4465be2b2acacb5e56064c2ffcd329a3f31b58;p=thirdparty%2Fbinutils-gdb.git 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. --- 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);