Browse Source

Throws BuildException if it tries to resolve a path which

will go further up than the root of the file-system.

Reported by:                                        Noris Boyd
Patch submitted by:                             Nico Seessle


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268073 13f79535-47bb-0310-9956-ffa450edef68
master
glennm 25 years ago
parent
commit
a1eaa272b4
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/main/org/apache/tools/ant/Project.java

+ 5
- 1
src/main/org/apache/tools/ant/Project.java View File

@@ -581,7 +581,11 @@ public class Project {
while (tok.hasMoreTokens()) { while (tok.hasMoreTokens()) {
String part = tok.nextToken(); String part = tok.nextToken();
if (part.equals("..")) { if (part.equals("..")) {
file = new File(file.getParent());
String parentFile = file.getParent();
if (parentFile == null) {
throw new BuildException("The file or path you specified (" + fileName + ") is invalid releative to " + baseDir.getAbsolutePath());
}
file = new File(parentFile);
} else if (part.equals(".")) { } else if (part.equals(".")) {
// Do nothing here // Do nothing here
} else { } else {


Loading…
Cancel
Save