made Display priveledged action private. Fixes a possible security exploit that would allow anyone to get a boolean from System properties *gasp*

This commit is contained in:
Brian Matzon 2006-07-02 20:26:49 +00:00
parent 33540d8195
commit a9edd6af6e
2 changed files with 15 additions and 2 deletions

View File

@ -711,7 +711,7 @@ public final class Display {
/**
* Gets a boolean property as a privileged action.
*/
static boolean getPrivilegedBoolean(final String property_name) {
private static boolean getPrivilegedBoolean(final String property_name) {
Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Boolean(Boolean.getBoolean(property_name));

View File

@ -48,6 +48,7 @@ import java.awt.event.ComponentListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
@ -72,7 +73,7 @@ final class MacOSXFrame extends Frame implements WindowListener, ComponentListen
addComponentListener(this);
canvas = new MacOSXGLCanvas();
add(canvas, BorderLayout.CENTER);
boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
boolean undecorated = getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated");
setUndecorated(fullscreen || undecorated);
if ( fullscreen ) {
try {
@ -212,4 +213,16 @@ final class MacOSXFrame extends Frame implements WindowListener, ComponentListen
}
return result;
}
/**
* Gets a boolean property as a privileged action.
*/
private static boolean getPrivilegedBoolean(final String property_name) {
Boolean value = (Boolean)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Boolean(Boolean.getBoolean(property_name));
}
});
return value.booleanValue();
}
}