glennm 00/10/10 09:27:24
Modified: src/main/org/apache/tools/ant Project.java
Log:
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
Revision Changes Path
1.44 +5 -1 jakarta-ant/src/main/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- Project.java 2000/10/04 09:57:55 1.43
+++ Project.java 2000/10/10 16:27:22 1.44
@@ -581,7 +581,11 @@
while (tok.hasMoreTokens()) {
String part = tok.nextToken();
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(".")) {
// Do nothing here
} else {