Skip to content

Commit

Permalink
Ignore file entries containing '..' in the APK file to fix #1498
Browse files Browse the repository at this point in the history
Zip/APK files can legally contain entries that point to the parent directory of the one in which the .zip is located.
Usually, unzip implementations ignore them by default, and we‘ll do the same.
  • Loading branch information
mkilling committed May 9, 2017
1 parent f979f20 commit 693f592
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java
Expand Up @@ -136,7 +136,8 @@ private void loadAll() {
subname = subname.substring(0, pos);
}

if (! mDirs.containsKey(subname)) {
boolean pointsToParentDirectory = (subname.equals("..") && prefixLen == 0);
if (! mDirs.containsKey(subname) && ! pointsToParentDirectory) {
AbstractDirectory dir = new ZipRODirectory(getZipFile(), getPath() + subname + separator);
mDirs.put(subname, dir);
}
Expand Down

0 comments on commit 693f592

Please sign in to comment.