http://sourceware.org/bugzilla/show_bug.cgi?id=15657

            Bug ID: 15657
           Summary: in the function "_bfd_stringtab_add", which is in
                    binutils-2.23/bfd/hash.c
           Product: binutils
           Version: 2.23
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: caojinyu at msn dot com

the function "_bfd_stringtab_add", 
if (! copy)
    entry->root.string = str;
      else
    {
      char *n;

      n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
      if (n == NULL)
        return (bfd_size_type) -1;
      entry->root.string = n;
    }

I think it should like this:
if (! copy)
    entry->root.string = str;
      else
    {
      char *n;

      n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
      if (n == NULL)
        return (bfd_size_type) -1;

          memcpy(n, str, strlen(str)+1);
      entry->root.string = n;
    }

Because if "copy" is true, then we should copy the "str" in the "n", which was 
allocate by "bfd_hash_allocate".

-- 
You are receiving this mail because:
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to