From 90f06f8f714362c10310753e2c4ccb9034a6bf44 Mon Sep 17 00:00:00 2001 From: jfrijters Date: Sat, 22 Oct 2011 06:33:39 +0000 Subject: Added security manager checks. --- openjdk/sun/nio/fs/NetPath.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'openjdk/sun') diff --git a/openjdk/sun/nio/fs/NetPath.java b/openjdk/sun/nio/fs/NetPath.java index 991cec4d..6861a1e2 100644 --- a/openjdk/sun/nio/fs/NetPath.java +++ b/openjdk/sun/nio/fs/NetPath.java @@ -418,11 +418,21 @@ final class NetPath extends AbstractPath { return this; } + // System.getProperty("user.dir") will trigger the specified security check return new NetPath(fs, cli.System.IO.Path.GetFullPath(cli.System.IO.Path.Combine(System.getProperty("user.dir"), path))); } public Path toRealPath(LinkOption... options) throws IOException { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + { + sm.checkRead(path); + if (!isAbsolute()) + { + sm.checkPropertyAccess("user.dir"); + } + } return new NetPath(fs, toRealPathImpl(path)); } @@ -487,6 +497,15 @@ final class NetPath extends AbstractPath throw new UnsupportedOperationException(); } } + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + { + sm.checkRead(path); + if (subtree) + { + sm.checkRead(path + cli.System.IO.Path.DirectorySeparatorChar + '-'); + } + } return ((NetFileSystem.NetWatchService)watcher).register(this, create, delete, modify, overflow, subtree); } -- cgit v1.2.3