summaryrefslogtreecommitdiff
path: root/security/fuzz/files/patch-fuzz.c
blob: ba229134bd9dafb216b4c967930dbf6cc54fec1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- fuzz.c.orig	Mon May 12 01:49:39 2003
+++ fuzz.c	Mon May 12 01:53:44 2003
@@ -387,10 +387,16 @@
     int progpipe[2],status;
     char sendnewline=0;
     unsigned long curchar=0,linelen=0;
+    int fd;
 
     // finish setting up files
     if(!execute_filename){
-      snprintf(outfilename,MAXPATH,"/tmp%s.%lu",strrchr(progname,'/'),runs);
+      snprintf(outfilename,MAXPATH,"/tmp%s.%lu.XXXXXX",strrchr(progname,'/'),runs);
+      if ((fd=mkstemp(outfilename)) < 0) {
+         perror("Unable to create temporary file");
+         abort();
+      }
+      close(fd);
       if((outfile=fopen(outfilename,"w"))==NULL){
 	fprintf(stderr,"Can't fopen outfile.\n");
 	abort();