From d4c88bbbc997676cbf6ab62282438ea7df2b4dd7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 25 Jun 2002 09:40:45 +0000 Subject: * elf64-ppc.c (ppc_add_stub): Replace strcpy/strncpy with memcpy. * elf32-hppa.c (hppa_add_stub): Likewise. * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise. * elflink.h (elf_add_default_symbol): Fix comment typo. (elf_add_default_symbol): Replace strcpy and strncpy with memcpy. (elf_link_add_object_symbols): Likewise. (elf_link_assign_sym_version): Likewise. * hash.c (bfd_hash_lookup): Likewise. * linker.c (_bfd_generic_link_add_one_symbol): Likewise. * section.c (bfd_get_unique_section_name): Likewise. * syms.c (_bfd_stab_section_find_nearest_line): Likewise. * elf.c (_bfd_elf_make_section_from_phdr): Likewise. (assign_section_numbers): Likewise. (_bfd_elfcore_make_pseudosection): Likewise. (elfcore_grok_lwpstatus): Likewise. (elfcore_grok_win32pstatus): Likewise. (elfcore_write_note): Constify input params. Use PTR instead of void *. Include terminating NUL in namesz. Correct padding. Support NULL "name" param. Use memcpy instead of strcpy. (elfcore_write_prpsinfo): Constify input params. (elfcore_write_prstatus): Likewise. Use PTR instead of void *. (elfcore_write_lwpstatus): Likewise. (elfcore_write_pstatus): Likewise. (elfcore_write_prfpreg): Likewise. (elfcore_write_prxfpreg): Likewise. * elf-bfd.h (elfcore_write_note): Update declaration. (elfcore_write_prpsinfo): Likewise. (elfcore_write_prstatus): Likewise. (elfcore_write_pstatus): Likewise. (elfcore_write_prfpreg): Likewise. (elfcore_write_prxfpreg): Likewise. (elfcore_write_lwpstatus): Likewise. --- bfd/syms.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bfd/syms.c') diff --git a/bfd/syms.c b/bfd/syms.c index 1c4bf28..a4f502f 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -1313,14 +1313,16 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, || strncmp (info->filename, directory_name, dirlen) != 0 || strcmp (info->filename + dirlen, file_name) != 0) { + size_t len; + if (info->filename != NULL) free (info->filename); - info->filename = (char *) bfd_malloc ((bfd_size_type) dirlen - + strlen (file_name) + 1); + len = strlen (file_name) + 1; + info->filename = (char *) bfd_malloc ((bfd_size_type) dirlen + len); if (info->filename == NULL) return false; - strcpy (info->filename, directory_name); - strcpy (info->filename + dirlen, file_name); + memcpy (info->filename, directory_name, dirlen); + memcpy (info->filename + dirlen, file_name, len); } *pfilename = info->filename; -- cgit v1.1