1
0
mirror of https://github.com/elisspace/autopsy.git synced 2026-09-06 02:24:30 +00:00

scalpel class: do additional file path validation before crossing jni boundary

This commit is contained in:
adam-m
2013-04-16 15:03:26 -04:00
parent 0ec6b6be2f
commit d888b7b863

View File

@@ -132,6 +132,17 @@ public class ScalpelCarver {
|| outputFolderPath == null || outputFolderPath.isEmpty()) {
throw new ScalpelException("Invalid arguments for scalpel carving. ");
}
//validate the paths passed in
File config = new File(configFilePath);
if (! config.exists() || ! config.canRead()) {
throw new ScalpelException("Cannot read libscalpel config file: " + configFilePath);
}
File outDir = new File(outputFolderPath);
if (! outDir.exists() || ! outDir.canWrite()) {
throw new ScalpelException("Cannot write to libscalpel output dir: " + outputFolderPath);
}
final String carverInputId = file.getId() + ": " + file.getName();
final ReadContentInputStream carverInput = new ReadContentInputStream(file);