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.
This commit is contained in:
Alan Modra
2023-08-03 08:40:12 +09:30
parent 23f6f86ca0
commit eaf1fa5ac5
9 changed files with 42 additions and 25 deletions

View File

@@ -92,6 +92,10 @@
extern char **environ;
#endif
#if !HAVE_DECL_STPCPY
extern char *stpcpy (char *__dest, const char *__src);
#endif
#define POISON_BFD_BOOLEAN 1
#endif /* ! defined (LD_SYSDEP_H) */