Skip to content

Commit

Permalink
merge zip
Browse files Browse the repository at this point in the history
  • Loading branch information
Wasim Nabil authored Feb 11, 2021
1 parent 977b57d commit c54aa43
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/android/Zip.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ private void unzipSync(CordovaArgs args, CallbackContext callbackContext) {
dir.mkdirs();
} else {
File file = new File(outputDirectory + compressedName);
String canonicalPath = file.getCanonicalPath();
if (!canonicalPath.startsWith(outputDirectory)) {
String errorMessage = "Zip traversal security error";
callbackContext.error(errorMessage);
Log.e(LOG_TAG, errorMessage);
return;
}
file.getParentFile().mkdirs();
if(file.exists() || file.createNewFile()){
Log.w("Zip", "extracting: " + file.getPath());
Expand Down

0 comments on commit c54aa43

Please sign in to comment.