changeset 3615:75d8c1200df8

7020522: Need to reapply the fix for 6664512 Reviewed-by: art, mchung
author dcherepanov
date Fri, 25 Feb 2011 13:58:54 +0300
parents df0de56682b7
children c27520009762
files src/share/classes/sun/util/logging/PlatformLogger.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/util/logging/PlatformLogger.java	Thu Feb 24 13:01:01 2011 +0300
+++ b/src/share/classes/sun/util/logging/PlatformLogger.java	Fri Feb 25 13:58:54 2011 +0300
@@ -535,7 +535,14 @@
         }
 
         void doLog(int level, String msg, Object... params) {
-            LoggingSupport.log(javaLogger, levelObjects.get(level), msg, params);
+            // only pass String objects to the j.u.l.Logger which may
+            // be created by untrusted code
+            int len = (params != null) ? params.length : 0;
+            Object[] sparams = new String[len];
+            for (int i = 0; i < len; i++) {
+                sparams [i] = String.valueOf(params[i]);
+            }
+            LoggingSupport.log(javaLogger, levelObjects.get(level), msg, sparams);
         }
 
         boolean isEnabled() {