diff options
author | Alan Modra <amodra@gmail.com> | 2023-08-03 08:40:12 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-08-03 21:19:54 +0930 |
commit | eaf1fa5ac5972efe5041c835c3ac9fec3c6aa06c (patch) | |
tree | 8534db6617357257593dabfdc483f8c819e0a47e /ld/pe-dll.c | |
parent | 23f6f86ca03e87883150d21a6ac3c00590ea450a (diff) | |
download | fsf-binutils-gdb-eaf1fa5ac5972efe5041c835c3ac9fec3c6aa06c.zip fsf-binutils-gdb-eaf1fa5ac5972efe5041c835c3ac9fec3c6aa06c.tar.gz fsf-binutils-gdb-eaf1fa5ac5972efe5041c835c3ac9fec3c6aa06c.tar.bz2 |
ld: sprintf sanitizer null destination pointer
* configure.ac (stpcpy): AC_CHECK_DECLS.
* sysdep.h (stpcpy): Add fallback declaraion.
* config.in: Regenerate.
* configure: Regenerate.
* emultempl/pe.em (open_dynamic_archive): Use
stpcpy rather than sprintf plus strlen.
* emultempl/pep.em (open_dynamic_archive): Likewise.
* emultempl/xtensaelf.em (elf_xtensa_before_allocation): Use
auto rather than malloc'd buffer. Use sprintf count.
* ldelf.c (ldelf_search_needed): Use memcpy in place of sprintf.
* pe-dll.c (pe_process_import_defs): Use string already formed
for alias match rather than recreating.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r-- | ld/pe-dll.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c index a95b85c..b45c530 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -3340,6 +3340,14 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo) false, false, false); if (blhe) is_undef = (blhe->type == bfd_link_hash_undefined); + + if (is_cdecl && (!blhe || !is_undef)) + { + blhe = pe_find_cdecl_alias_match (linfo, name + 6); + include_jmp_stub = true; + if (blhe) + is_undef = (blhe->type == bfd_link_hash_undefined); + } } else { @@ -3347,16 +3355,6 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *linfo) is_undef = (blhe->type == bfd_link_hash_undefined); } - if (is_cdecl - && (!blhe || (blhe && blhe->type != bfd_link_hash_undefined))) - { - sprintf (name, "%s%s",U (""), imp[i].internal_name); - blhe = pe_find_cdecl_alias_match (linfo, name); - include_jmp_stub = true; - if (blhe) - is_undef = (blhe->type == bfd_link_hash_undefined); - } - free (name); if (is_undef) |