(pe_ILF_build_a_bfd): Do not assume that an @ will be present when
authorNick Clifton <nickc@redhat.com>
Mon, 28 Feb 2005 16:07:33 +0000 (16:07 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 28 Feb 2005 16:07:33 +0000 (16:07 +0000)
IMPORT_NAME_UNDOECRATE is used.

bfd/ChangeLog
bfd/peicode.h

index a0cc726edd582f24f0ad6960f270cc7759f0a225..69634157f2b76ff1d758e89b7b6c7ea1bcc4e66c 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-28  Ross Ridge  <rridge@csclub.uwaterloo.ca>
+
+       * peicode.h (pe_ILF_build_a_bfd): Do not assume that an @ will be
+       present when IMPORT_NAME_UNDOECRATE is used.
+
 2005-02-28  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR 757
index 1282bb9b1c86d71e36d644ff01b6534fc6ccb58e..7d5f361ef911c78909ccccc77533e0c32c52ce32 100644 (file)
@@ -865,6 +865,7 @@ pe_ILF_build_a_bfd (bfd *           abfd,
   else
     {
       char * symbol;
+      unsigned int len;
 
       /* Create .idata$6 - the Hint Name Table.  */
       id6 = pe_ILF_make_a_section (& vars, ".idata$6", SIZEOF_IDATA6, 0);
@@ -909,19 +910,21 @@ pe_ILF_build_a_bfd (bfd *           abfd,
          while (check_again);
        }
       
+      len = strlen (symbol);
       if (import_name_type == IMPORT_NAME_UNDECORATE)
        {
-         /* Truncate at the first '@'  */
-         while (* symbol != 0 && * symbol != '@')
-           symbol ++;
+         /* Truncate at the first '@'.  */
+         char *at = strchr (symbol, '@');
 
-         * symbol = 0;
+         if (at != NULL)
+           len = at - symbol;
        }
 
       id6->contents[0] = ordinal & 0xff;
       id6->contents[1] = ordinal >> 8;
 
-      strcpy ((char *) id6->contents + 2, symbol);
+      memcpy ((char *) id6->contents + 2, symbol, len);
+      id6->contents[len + 2] = '\0';
     }
 
   if (import_name_type != IMPORT_ORDINAL)
This page took 0.031088 seconds and 4 git commands to generate.