diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2000-09-12 22:41:59 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2000-09-12 22:41:59 +0000 |
commit | 7c2f7dbedb7ee86b19acd5e44e95ec14f3aeea7f (patch) | |
tree | 6fdf6ce13c70f6e4fe1b7e09c98a5b3e54051b4a | |
parent | f318de9eb596b889cf300f595913242f0f9e5692 (diff) |
Avoid calls to insecure choose_temp_base
-rw-r--r-- | gnu/usr.bin/binutils/binutils/dlltool.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/binutils/dllwrap.c | 21 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/binutils/objdump.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/binutils/resrc.c | 12 |
4 files changed, 22 insertions, 19 deletions
diff --git a/gnu/usr.bin/binutils/binutils/dlltool.c b/gnu/usr.bin/binutils/binutils/dlltool.c index b618b969946..69ea7df33a7 100644 --- a/gnu/usr.bin/binutils/binutils/dlltool.c +++ b/gnu/usr.bin/binutils/binutils/dlltool.c @@ -1117,7 +1117,11 @@ run (what, args) int i; const char **argv; char *errmsg_fmt, *errmsg_arg; +#if defined(__MSDOS__) && !defined(__GO32__) char *temp_base = choose_temp_base (); +#else + char *temp_base = NULL; +#endif inform ("run: %s %s", what, args); diff --git a/gnu/usr.bin/binutils/binutils/dllwrap.c b/gnu/usr.bin/binutils/binutils/dllwrap.c index 637fa52fc17..4f3607dbb06 100644 --- a/gnu/usr.bin/binutils/binutils/dllwrap.c +++ b/gnu/usr.bin/binutils/binutils/dllwrap.c @@ -392,7 +392,11 @@ run (what, args) int i; const char **argv; char *errmsg_fmt, *errmsg_arg; +#if defined(__MSDOS__) && !defined(__GO32__) char *temp_base = choose_temp_base (); +#else + char *temp_base = NULL; +#endif int in_quote; char sep; @@ -834,12 +838,9 @@ main (argc, argv) if (! def_file_seen) { - char *fileprefix = choose_temp_base (); - def_file_name = (char *) xmalloc (strlen (fileprefix) + 5); - sprintf (def_file_name, "%s.def", - (dontdeltemps) ? mybasename (fileprefix) : fileprefix); - delete_def_file = 1; - free (fileprefix); + def_file_name = make_temp_file (".def"); + if (dontdeltemps) + def_file_name = mybasename (def_file_name); delete_def_file = 1; warn (_("no export definition file provided")); warn (_("creating one, but that may not be what you want")); @@ -1022,12 +1023,10 @@ main (argc, argv) if (! base_file_name) { - char *fileprefix = choose_temp_base (); - base_file_name = (char *) xmalloc (strlen (fileprefix) + 6); - sprintf (base_file_name, "%s.base", - (dontdeltemps) ? mybasename (fileprefix) : fileprefix); + base_file_name = make_temp_file (".base"); + if (dontdeltemps) + base_file_name = mybasename (base_file_name); delete_base_file = 1; - free (fileprefix); } { diff --git a/gnu/usr.bin/binutils/binutils/objdump.c b/gnu/usr.bin/binutils/binutils/objdump.c index d3c1ed217d5..6b20aa27e93 100644 --- a/gnu/usr.bin/binutils/binutils/objdump.c +++ b/gnu/usr.bin/binutils/binutils/objdump.c @@ -2630,7 +2630,7 @@ display_target_list () char *dummy_name; int t; - dummy_name = choose_temp_base (); + dummy_name = make_temp_file (NULL); for (t = 0; bfd_target_vector[t]; t++) { bfd_target *p = bfd_target_vector[t]; @@ -2684,7 +2684,7 @@ display_info_table (first, last) printf ("%s ", bfd_target_vector[t]->name); putchar ('\n'); - dummy_name = choose_temp_base (); + dummy_name = make_temp_file (NULL); for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++) if (strcmp (bfd_printable_arch_mach (a, 0), "UNKNOWN!") != 0) { diff --git a/gnu/usr.bin/binutils/binutils/resrc.c b/gnu/usr.bin/binutils/binutils/resrc.c index 8c3c9a74d22..a522a9ff3ba 100644 --- a/gnu/usr.bin/binutils/binutils/resrc.c +++ b/gnu/usr.bin/binutils/binutils/resrc.c @@ -185,7 +185,12 @@ run_cmd (cmd, redir) int i; const char **argv; char *errmsg_fmt, *errmsg_arg; +#if defined(__MSDOS__) && !defined(__GO32__) char *temp_base = choose_temp_base (); +#else + char *temp_base = NULL; +#endif + int in_quote; char sep; int redir_handle = -1; @@ -297,12 +302,7 @@ open_input_stream (cmd) { if (istream_type == ISTREAM_FILE) { - char *fileprefix; - - fileprefix = choose_temp_base (); - cpp_temp_file = (char *) xmalloc (strlen (fileprefix) + 5); - sprintf (cpp_temp_file, "%s.irc", fileprefix); - free (fileprefix); + cpp_temp_file = make_temp_file (".irc"); if (run_cmd (cmd, cpp_temp_file)) fatal (_("can't execute `%s': %s"), cmd, strerror (errno)); |