PR25961, buffer overflow in coff_swap_aux_in
[deliverable/binutils-gdb.git] / bfd / elf64-mips.c
index b674d52f7c68c3a203f1c6e1d6ffdf78e0b583bb..413018fcf3e35b041c3a6b408935a92d61d807e9 100644 (file)
@@ -4010,15 +4010,12 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
   int entsize;
   bfd_boolean rela_p;
 
-  allocated = bfd_malloc (rel_hdr->sh_size);
+  if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0)
+    return FALSE;
+  allocated = _bfd_malloc_and_read (abfd, rel_hdr->sh_size, rel_hdr->sh_size);
   if (allocated == NULL)
     return FALSE;
 
-  if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
-      || (bfd_bread (allocated, rel_hdr->sh_size, abfd)
-         != rel_hdr->sh_size))
-    goto error_return;
-
   native_relocs = allocated;
 
   entsize = rel_hdr->sh_entsize;
This page took 0.024992 seconds and 4 git commands to generate.