From: Matt I. <mat...@us...> - 2005-07-29 02:49:37
|
Update of /cvsroot/ant-contrib/ant-contrib/src/net/sf/antcontrib/antserver/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31023/commands Modified Files: SendFileCommand.java Log Message: Fix a few misleading error messages Index: SendFileCommand.java =================================================================== RCS file: /cvsroot/ant-contrib/ant-contrib/src/net/sf/antcontrib/antserver/commands/SendFileCommand.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SendFileCommand.java 6 Feb 2004 16:27:28 -0000 1.7 --- SendFileCommand.java 29 Jul 2005 02:49:29 -0000 1.8 *************** *** 101,104 **** --- 101,105 ---- + " at least one must be supplied"); + /* try { *************** *** 112,115 **** --- 113,117 ---- throw new BuildException(e); } + */ *************** *** 126,129 **** --- 128,135 ---- { dest = new File(project.getBaseDir(), tofile); + if (! new File(tofile).getCanonicalPath().startsWith(project.getBaseDir().getCanonicalPath())) { + System.out.println("throwing an exception"); + throw new SecurityException("The requested filename must be a relative path."); + } } else *************** *** 132,135 **** --- 138,145 ---- dest = new File(dest, fileBaseName); + if (! new File(todir, tofile).getCanonicalPath().startsWith(project.getBaseDir().getCanonicalPath())) { + throw new SecurityException("The requested filename must be a relative path."); + } + } |