Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Revert D33633205: address path traversal vulnerability
Browse files Browse the repository at this point in the history
Differential Revision:
D33633205 (62b922a)

Original commit changeset: 1834fcdfa96b

Original Phabricator Diff: D33633205 (62b922a)

fbshipit-source-id: bb09fe48749b284f4cc5e7d9e7e51e985a9897de
  • Loading branch information
Yaron Bachar authored and facebook-github-bot committed Jan 28, 2022
1 parent 62b922a commit 464a578
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions deps/zip/ZipHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.zip.ZipOutputStream;

public class ZipHelper {

public static final String ZIP_SUFFIX = ".zip";
public static final String TMP_SUFFIX = ".tmp";

Expand Down Expand Up @@ -134,9 +135,6 @@ public static boolean extractZip(InputStream inputStream, File extractDir) throw

while (entry != null) {
File newFile = new File(extractDir, entry.getName());
if (!newFile.getCanonicalPath().startsWith(extractDir.getName())) {
throw new IOException("Invalid entry name");
}
if (entry.isDirectory()) {
if (!newFile.isDirectory() && !newFile.mkdirs()) {
throw new IOException("Can't create directory");
Expand Down

0 comments on commit 464a578

Please sign in to comment.