mingw-binutils/CVE-2022-4285.patch
2023-01-03 16:43:16 +01:00

15 lines
642 B
Diff

diff -rupN --no-dereference binutils-2.39/bfd/elf.c binutils-2.39-new/bfd/elf.c
--- binutils-2.39/bfd/elf.c 2023-01-03 14:19:15.884413890 +0100
+++ binutils-2.39-new/bfd/elf.c 2023-01-03 14:19:28.670166584 +0100
@@ -8868,7 +8868,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd
bfd_set_error (bfd_error_file_too_big);
goto error_return_verref;
}
- elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_alloc (abfd, amt);
+ if (amt == 0)
+ goto error_return_verref;
+ elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verref == NULL)
goto error_return_verref;