Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix symbolic link bug of installDirectory #831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ public void extract(String archive, String destinationDirectory) throws ArchiveE
TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
while (tarEntry != null) {
// Create a file for this tarEntry
final File directoryPath = new File(destinationDirectory);
final File destPath = new File(destinationDirectory + File.separator + tarEntry.getName());
prepDestination(destPath, tarEntry.isDirectory());
if (!destPath.getCanonicalPath().startsWith(destinationDirectory)) {
if (!destPath.getCanonicalPath().startsWith(directoryPath.getCanonicalPath())) {
throw new IOException(
"Expanding " + tarEntry.getName() + " would create file outside of " + destinationDirectory
"Expanding " + tarEntry.getName() + " would create file " + destPath.getCanonicalPath() + ", which is outside of " + directoryPath.getCanonicalPath()
);
}
if (!tarEntry.isDirectory()) {
Expand Down