aboutsummaryrefslogtreecommitdiff
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
commitf67e617a26e6d1efafb752d5047b4ddc33056ab1 (patch)
treedd6543497d7b53ed5f146f56abe5a1a0918048d6 /bfd/peicode.h
parentaf44c138410f6f30e1b01a5551ebbb36fd93682d (diff)
downloadgdb-f67e617a26e6d1efafb752d5047b4ddc33056ab1.zip
gdb-f67e617a26e6d1efafb752d5047b4ddc33056ab1.tar.gz
gdb-f67e617a26e6d1efafb752d5047b4ddc33056ab1.tar.bz2
(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 1282bb9..7d5f361 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)