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
This commit is contained in:
Tom Tromey 2001-12-21 22:51:41 +00:00 committed by Tom Tromey
parent d47eb5d3f2
commit e3109d4c17
3 changed files with 16 additions and 5 deletions

View file

@ -1,5 +1,5 @@
/* 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.
@ -550,8 +550,11 @@ public class ObjectOutputStream extends OutputStream
throws SecurityException
{
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;
replacementEnabled = enable;