mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-16 06:08:09 +08:00
binutils sprintf optimisation
Avoid the use of sprintf with a "%s" format string, replacing with strcpy or stpcpy. Use sprintf return value rather than a later strlen. Don't use strcat where we can keep track of the end of a string output buffer. * dlltool.c (look_for_prog): memcpy prefix and strcpy prog_name. * dllwrap.c (look_for_prog): Likewise. * resrc.c (look_for_default): Likewise. Add quotes with memmove rather than allocating another buffer. * size.c (size_number): Use sprintf return value. * stabs.c (parse_stab_argtypes): Likewise. * windmc.c (write_bin): Likewes, and use stpcpy. * wrstabs.c: Similarly throughout.
This commit is contained in:
@@ -186,9 +186,9 @@ look_for_prog (const char *progname, const char *prefix, int end_prefix)
|
||||
+ strlen (EXECUTABLE_SUFFIX)
|
||||
#endif
|
||||
+ 10);
|
||||
strcpy (cmd, prefix);
|
||||
memcpy (cmd, prefix, end_prefix);
|
||||
|
||||
sprintf (cmd + end_prefix, "%s", progname);
|
||||
strcpy (cmd + end_prefix, progname);
|
||||
|
||||
if (strchr (cmd, '/') != NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user