[binutils-gdb] PR 33021, buffer overflow in write_dwarf_eh_frame_hdr

Alan Modra amodra@sourceware.org
Wed May 28 06:27:48 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5d4465be2b2acacb5e56064c2ffcd329a3f31b58

commit 5d4465be2b2acacb5e56064c2ffcd329a3f31b58
Author: Alan Modra <amodra@gmail.com>
Date:   Wed May 28 15:12:39 2025 +0930

    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:
---
 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);


More information about the Binutils-cvs mailing list