FYI: fix File.renameTo() security checks
Gary Benson
gbenson@redhat.com
Wed Jul 12 15:30:00 GMT 2006
Hi all,
This commit fixes the security checks performed by File.renameTo().
They were being performed using only the filename part of the paths
rather than the full paths.
Cheers,
Gary
-------------- next part --------------
Index: ChangeLog
===================================================================
--- ChangeLog (revision 115372)
+++ ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2006-07-12 Gary Benson <gbenson@redhat.com>
+
+ * java/io/File.java (renameTo): Fix security checks.
+
2006-07-12 Bryce McKinlay <mckinlay@redhat.com>
PR libgcj/28352
Index: java/io/File.java
===================================================================
--- java/io/File.java (revision 115372)
+++ java/io/File.java (working copy)
@@ -1298,12 +1298,10 @@
public synchronized boolean renameTo(File dest)
{
SecurityManager s = System.getSecurityManager();
- String sname = getName();
- String dname = dest.getName();
if (s != null)
{
- s.checkWrite (sname);
- s.checkWrite (dname);
+ s.checkWrite (getPath());
+ s.checkWrite (dest.getPath());
}
return performRenameTo (dest);
}
More information about the Java-patches
mailing list