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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user