More fixes for buffer overruns instigated by corrupt binaries.
[deliverable/binutils-gdb.git] / bfd / xcofflink.c
index 1ca9c2e546d887c4c0bbf79b38bf9235b9d9b8ff..952297451b988566864332291124a71925df6b05 100644 (file)
@@ -4494,7 +4494,10 @@ xcoff_link_input_bfd (struct xcoff_final_link_info *flinfo,
                          if (strings == NULL)
                            return FALSE;
                        }
-                     filename = strings + aux.x_file.x_n.x_offset;
+                     if ((bfd_size_type) aux.x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd))
+                       filename = _("<corrupt>");
+                     else
+                       filename = strings + aux.x_file.x_n.x_offset;
                      indx = _bfd_stringtab_add (flinfo->strtab, filename,
                                                 hash, copy);
                      if (indx == (bfd_size_type) -1)
This page took 0.023016 seconds and 4 git commands to generate.