I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ec3fd9a7 authored by zzz's avatar zzz
Browse files

null check in zip entry name

parent 304f2ebb
No related branches found
No related tags found
No related merge requests found
...@@ -109,10 +109,14 @@ public class FileUtil { ...@@ -109,10 +109,14 @@ public class FileUtil {
Enumeration<? extends ZipEntry> entries = zip.entries(); Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry)entries.nextElement(); ZipEntry entry = (ZipEntry)entries.nextElement();
if (entry.getName().indexOf("..") != -1) { if (entry.getName().contains("..")) {
System.err.println("ERROR: Refusing to extract a zip entry with '..' in it [" + entry.getName() + "]"); System.err.println("ERROR: Refusing to extract a zip entry with '..' in it [" + entry.getName() + "]");
return false; return false;
} }
if (entry.getName().indexOf(0) >= 0) {
System.err.println("ERROR: Refusing to extract a zip entry with null in it [" + entry.getName() + "]");
return false;
}
File target = new File(targetDir, entry.getName()); File target = new File(targetDir, entry.getName());
File parent = target.getParentFile(); File parent = target.getParentFile();
if ( (parent != null) && (!parent.exists()) ) { if ( (parent != null) && (!parent.exists()) ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment