summaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-02-28 16:07:33 +0000
committerNick Clifton <nickc@redhat.com>2005-02-28 16:07:33 +0000
commiteb97e3b19c405eae1259f3fe9809af89bc5a27ba (patch)
tree1d79f00c00eacbcc4138540945c95b7051952c7e /bfd/peicode.h
parent85b9c919eaac62604d1f0a1163b7883653b90853 (diff)
downloadbinutils-redhat-eb97e3b19c405eae1259f3fe9809af89bc5a27ba.tar.gz
(pe_ILF_build_a_bfd): Do not assume that an @ will be present when
IMPORT_NAME_UNDOECRATE is used.
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r--bfd/peicode.h13
1 files changed, 8 insertions, 5 deletions
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)