aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 106fafc..9d798ef 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2413,16 +2413,18 @@ ppc_add_stub (stub_name, section, htab)
stub_sec = htab->stub_group[link_sec->id].stub_sec;
if (stub_sec == NULL)
{
+ size_t namelen;
bfd_size_type len;
char *s_name;
- len = strlen (link_sec->name) + sizeof (STUB_SUFFIX);
+ namelen = strlen (link_sec->name);
+ len = namelen + sizeof (STUB_SUFFIX);
s_name = bfd_alloc (htab->stub_bfd, len);
if (s_name == NULL)
return NULL;
- strcpy (s_name, link_sec->name);
- strcpy (s_name + len - sizeof (STUB_SUFFIX), STUB_SUFFIX);
+ memcpy (s_name, link_sec->name, namelen);
+ memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
stub_sec = (*htab->add_stub_section) (s_name, link_sec);
if (stub_sec == NULL)
return NULL;