]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
buffer overflow in mmix_elf_relocate_section
authorAlan Modra <amodra@gmail.com>
Fri, 17 Jan 2025 04:11:39 +0000 (14:41 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 17 Jan 2025 05:37:48 +0000 (16:07 +1030)
* elf64-mmix.c (mmix_elf_relocate_section): Correct size of
relocs shuffled by memmove.

bfd/elf64-mmix.c

index c377222676d935e3c464804ff0423a4efbee8a77..5bb6feee16eb2b1cea9185e7e272cea1357f9525 100644 (file)
@@ -1496,7 +1496,7 @@ mmix_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
                  /* Shift this reloc to the end of the relocs to maintain
                     the r_offset sorted reloc order.  */
                  relcpy = *rel;
-                 memmove (rel, rel + 1, (char *) relend - (char *) rel);
+                 memmove (rel, rel + 1, (char *) relend - (char *) (rel + 1));
                  relend[-1] = relcpy;
 
                  /* Back up one reloc, or else we'd skip the next reloc