Michael Koch wrote:
> On Wed, Nov 16, 2005 at 11:56:37AM +0000, Gary Benson wrote:
> > I found a bug where the thing that throws SecurityExceptions can
> > itself cause a SecurityException to be thrown causing an infinite
> > loop.
> >
> > When java.security.AccessControlContext.checkPermission decides
> > that a permission is denied it throws the exception with the
> > following line:
> >
> > throw new AccessControlException ("permission "
> > + perm
> > + " not granted: "
> > + domain
> > + " does not imply it.");
> >
> > Where "domain" is a java.security.ProtectionDomain, whose
> > toString() method calls System.getProperty("line.separator"). If
> > your security policy denies read access to that system property
> > then it's going to end up trying to throw the same
> > AccessControlException and failing to access line.separator again,
> > ad infinitum (until you run out of stack).
> >
> > I wasn't sure quite how best to fix this so I haven't made a patch.
>
> The solution is to use gnu.classpath.SystemProperties.getProperty(...).
> This does no security check. It is exactly for such issues.
Sure, here you are.
Cheers,
Gary
Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.5612
diff -u -r1.5612 ChangeLog
--- ChangeLog 15 Nov 2005 23:07:23 -0000 1.5612
+++ ChangeLog 16 Nov 2005 12:51:26 -0000
@@ -1,3 +1,9 @@
+2005-11-16 Gary Benson <[EMAIL PROTECTED]>
+
+ * java/security/ProtectionDomain.java (toString): Use
+ gnu.classpath.SystemProperties to read line.separator
+ without security manager check.
+
2005-11-15 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/JComponent.java
Index: java/security/ProtectionDomain.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/ProtectionDomain.java,v
retrieving revision 1.13
diff -u -r1.13 ProtectionDomain.java
--- java/security/ProtectionDomain.java 2 Jul 2005 20:32:40 -0000 1.13
+++ java/security/ProtectionDomain.java 16 Nov 2005 12:51:26 -0000
@@ -37,6 +37,8 @@
package java.security;
+import gnu.classpath.SystemProperties;
+
/**
* <p>This <code>ProtectionDomain</code> class encapsulates the characteristics
* of a domain, which encloses a set of classes whose instances are granted a
@@ -222,7 +224,7 @@
*/
public String toString()
{
- String linesep = System.getProperty("line.separator");
+ String linesep = SystemProperties.getProperty("line.separator");
StringBuffer sb = new StringBuffer("ProtectionDomain (").append(linesep);
if (code_source == null)
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches