Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SECURITY] Fix Temporary Directory Hijacking or Information Disclosure Vulnerability #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/main/java/de/mpii/fsm/driver/FsmDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package de.mpii.fsm.driver;

import java.io.File;
import java.nio.file.Files;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
Expand Down Expand Up @@ -418,12 +419,7 @@ public int run(String[] args) throws Exception {
commonConfig.setIntermediatePath(params.get("keepFiles"));
}
else{
File intermediateOutputPath = File.createTempFile("MG_FSM_INTRM_OP_", "");

//Below JDK 7 we are only allowed to create temporary files.
//Hence, turn the file into a directory in temporary folder.
intermediateOutputPath.delete();
intermediateOutputPath.mkdir();
File intermediateOutputPath = Files.createTempDirectory("MG_FSM_INTRM_OP_").toFile();

commonConfig.setIntermediatePath(intermediateOutputPath.getAbsolutePath().toString());

Expand Down Expand Up @@ -558,4 +554,4 @@ public static void main(String[] args) throws Exception {
ToolRunner.run(new Configuration(), new FsmDriver(), args);
}

}
}