mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
@@ -115,8 +115,7 @@ public class AndroidProjectCreator {
|
||||
}
|
||||
|
||||
private void processListing(File outputDirectory, GFileSystem fs, List<GFile> listing,
|
||||
TaskMonitor monitor)
|
||||
throws IOException, CancelledException {
|
||||
TaskMonitor monitor) throws IOException, CancelledException {
|
||||
for (GFile child : listing) {
|
||||
|
||||
String childName = child.getName();
|
||||
@@ -131,6 +130,10 @@ public class AndroidProjectCreator {
|
||||
continue;
|
||||
}
|
||||
File subDir = new File(outputDirectory, childName);
|
||||
if (!FileUtilities.isPathContainedWithin(outputDirectory, subDir)) {
|
||||
Msg.error(this, "Skipping directory with path traversal: " + childName);
|
||||
continue;
|
||||
}
|
||||
FileUtilities.checkedMkdir(subDir);
|
||||
processListing(subDir, fs, child.getListing(), monitor);
|
||||
continue;
|
||||
@@ -220,6 +223,9 @@ public class AndroidProjectCreator {
|
||||
try (InputStream is = inputFile.getInputStream()) {
|
||||
FileUtilities.checkedMkdirs(outputDirectory);
|
||||
File destFile = new File(outputDirectory, outputName);
|
||||
if (!FileUtilities.isPathContainedWithin(outputDirectory, destFile)) {
|
||||
throw new IOException("Path traversal detected in entry name: " + outputName);
|
||||
}
|
||||
|
||||
monitor.setMessage("Copying [" + inputFile.getName() + "] to Eclipse project...");
|
||||
FileUtilities.copyStreamToFile(is, destFile, false, monitor);
|
||||
|
||||
Reference in New Issue
Block a user