From e60db078d26e01cba3c50d8a22973f157c9f9341 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 23 Jan 2016 15:56:01 -0800 Subject: [PATCH] Use mkstemp instead of mktemp - mktemp is intrinsically unsafe. --- initialize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/initialize.c b/initialize.c index 1333f42..e7ad14d 100644 --- a/initialize.c +++ b/initialize.c @@ -351,7 +351,7 @@ initializeStuff(int argc, char **argv) installCommandLineDefineSymbols(); if (listingOn) { - if ((saveFileForPass2 = fopen(mktemp(pass2SourceFileName), + if ((saveFileForPass2 = fopen(mkstemp(pass2SourceFileName), "w+")) == NULL) { fatalSystemError(UNABLE_TO_OPEN_PASS_2_FILE_ERROR, pass2SourceFileName); @@ -360,7 +360,7 @@ initializeStuff(int argc, char **argv) unlink(pass2SourceFileName); /* will take effect on program exit */ - if ((indexFileForPass2 = fopen(mktemp(pass2IndexFileName), + if ((indexFileForPass2 = fopen(mkstemp(pass2IndexFileName), "w+")) == NULL) { fatalSystemError(UNABLE_TO_OPEN_PASS_2_FILE_ERROR, pass2IndexFileName); @@ -370,7 +370,7 @@ initializeStuff(int argc, char **argv) program exit */ if (expandMacros) { - if ((macroFileForPass2 = fopen(mktemp( + if ((macroFileForPass2 = fopen(mkstemp( pass2MacroExpansionFileName),"w+")) == NULL) { fatalSystemError( UNABLE_TO_OPEN_PASS_2_FILE_ERROR,