bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/15657] New: in the function "_bfd_stringtab_add", which is


From: caojinyu at msn dot com
Subject: [Bug binutils/15657] New: in the function "_bfd_stringtab_add", which is in binutils-2.23/bfd/hash.c
Date: Thu, 20 Jun 2013 10:07:30 +0000

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]