Skip to content

Commit

Permalink
use Files.createTempFile instead of File.createTempFile because of se…
Browse files Browse the repository at this point in the history
…curity vulnerability (#92)
  • Loading branch information
davidmoten authored Nov 24, 2022
1 parent 71ec8e6 commit bdb85d7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;

/**
* This works like a ByteArrayOutputStream until a certain size is
Expand Down Expand Up @@ -66,7 +67,7 @@ protected void thresholdReached(int current, int predicted) throws IOException
// Open a temp file, write the byte array version, and swap the
// output stream to the file version.

this.outFile = File.createTempFile(TMPFILE_PREFIX, TMPFILE_SUFFIX);
this.outFile = Files.createTempFile(TMPFILE_PREFIX, TMPFILE_SUFFIX).toFile();
this.outFileStream = new FileOutputStream(this.outFile);

((ByteArrayOutputStream)this.output).writeTo(this.outFileStream);
Expand Down

0 comments on commit bdb85d7

Please sign in to comment.