This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: libiberty/choose_temp.c replace mktemp with mkstemp
- To: gcc-patches at gcc dot gnu dot org
- Subject: Patch: libiberty/choose_temp.c replace mktemp with mkstemp
- From: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- Date: Wed, 28 Feb 2001 18:34:53 +0100 (CET)
The call of mktemp() is considered as a potential security risk. Thus,
the following patch replaces it with mkstemp in the file
libiberty/choose-temp.c. After applying the appended patch, I
bootstrapped the compiler and ran the testsuites. There were no regressions.
Peter Schmid
2001-02-28 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
* choose-temp.c (choose_temp_base): Replace mktemp with mkstemp
*** libiberty/choose-temp.c.orig Tue Feb 27 22:57:02 2001
--- libiberty/choose-temp.c Tue Feb 27 23:03:44 2001
*************** choose_temp_base ()
*** 137,145 ****
temp_filename[len++] = DIR_SEPARATOR;
strcpy (temp_filename + len, TEMP_FILE);
! mktemp (temp_filename);
! if (strlen (temp_filename) == 0)
! abort ();
return temp_filename;
}
/* Return a temporary file name (as a string) or NULL if unable to create
--- 137,144 ----
temp_filename[len++] = DIR_SEPARATOR;
strcpy (temp_filename + len, TEMP_FILE);
! if (mkstemp (temp_filename) == -1)
! abort ();
return temp_filename;
}
/* Return a temporary file name (as a string) or NULL if unable to create