Commit e3109d4c by Tom Tromey Committed by Tom Tromey

ObjectInputStream.java (enableResolveObject): Use correct security check.

	* java/io/ObjectInputStream.java (enableResolveObject): Use
	correct security check.
	* java/io/ObjectOutputStream.java (enableReplaceObject): Use
	correct security check.

From-SVN: r48256
parent d47eb5d3
2001-12-21 Tom Tromey <tromey@redhat.com> 2001-12-21 Tom Tromey <tromey@redhat.com>
* java/io/ObjectInputStream.java (enableResolveObject): Use
correct security check.
* java/io/ObjectOutputStream.java (enableReplaceObject): Use
correct security check.
Fix for PR java/5165: Fix for PR java/5165:
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass):
Convert any constant string field to a String; not just final Convert any constant string field to a String; not just final
......
...@@ -528,8 +528,11 @@ public class ObjectInputStream extends InputStream ...@@ -528,8 +528,11 @@ public class ObjectInputStream extends InputStream
throws SecurityException throws SecurityException
{ {
if (enable) if (enable)
if (getClass ().getClassLoader () != null) {
throw new SecurityException ("Untrusted ObjectInputStream subclass attempted to enable object resolution"); SecurityManager sm = System.getSecurityManager ();
if (sm != null)
sm.checkPermission (new SerializablePermission ("enableSubtitution"));
}
boolean old_val = this.resolveEnabled; boolean old_val = this.resolveEnabled;
this.resolveEnabled = enable; this.resolveEnabled = enable;
......
/* ObjectOutputStream.java -- Class used to write serialized objects /* ObjectOutputStream.java -- Class used to write serialized objects
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -550,8 +550,11 @@ public class ObjectOutputStream extends OutputStream ...@@ -550,8 +550,11 @@ public class ObjectOutputStream extends OutputStream
throws SecurityException throws SecurityException
{ {
if (enable) if (enable)
if (getClass ().getClassLoader () != null) {
throw new SecurityException ("Untrusted ObjectOutputStream subclass attempted to enable object replacement"); SecurityManager sm = System.getSecurityManager ();
if (sm != null)
sm.checkPermission (new SerializablePermission ("enableSubstitution"));
}
boolean old_val = replacementEnabled; boolean old_val = replacementEnabled;
replacementEnabled = enable; replacementEnabled = enable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment