parent
55edae2b7b
commit
9c403d59d2
@ -458,13 +458,13 @@ public class ImportingUtilities {
|
|||||||
name = name.substring(0, q);
|
name = name.substring(0, q);
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = new File(dir, name);
|
File file = new File(dir, name);
|
||||||
// For CVE-2018-19859, issue #1840
|
// For CVE-2018-19859, issue #1840
|
||||||
if (!file.toPath().normalize().startsWith(dir.toPath().normalize())) {
|
if (!file.toPath().normalize().startsWith(dir.toPath().normalize() + File.separator)) {
|
||||||
throw new IllegalArgumentException("Zip archives with files escaping their root directory are not allowed.");
|
throw new IllegalArgumentException("Zip archives with files escaping their root directory are not allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int dot = name.indexOf('.');
|
int dot = name.lastIndexOf('.');
|
||||||
String prefix = dot < 0 ? name : name.substring(0, dot);
|
String prefix = dot < 0 ? name : name.substring(0, dot);
|
||||||
String suffix = dot < 0 ? "" : name.substring(dot);
|
String suffix = dot < 0 ? "" : name.substring(dot);
|
||||||
int index = 2;
|
int index = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user