summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/peicode.h13
2 files changed, 13 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a0cc726edd..69634157f2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 1282bb9b1c..7d5f361ef9 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -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)