changeset 3945:b7381aa8dd77

7029832: Buffer overrun at awt_LoadLibrary.c (and java_props_md.c) Reviewed-by: anthony, art
author dav
date Fri, 08 Apr 2011 18:29:27 +0400
parents 675a582ffdf0
children b58d1c9fa886
files src/solaris/native/sun/awt/awt_LoadLibrary.c
diffstat 1 files changed, 3 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/sun/awt/awt_LoadLibrary.c	Fri Apr 08 15:00:20 2011 +0400
+++ b/src/solaris/native/sun/awt/awt_LoadLibrary.c	Fri Apr 08 18:29:27 2011 +0400
@@ -128,12 +128,12 @@
         }
     }
 
-    /* Calculate toolkit name, kind of toolkit (XAWT, Motif) and library to load */
+    /* Calculate library name to load */
     if (AWTIsHeadless()) {
-        strcpy(p, "/headless/libmawt");
+        strncpy(p, "/headless/libmawt.so", MAXPATHLEN-len-1);
     } else {
         /* Default AWT Toolkit on Linux and Solaris is XAWT. */
-        strcpy(p, "/xawt/libmawt");
+        strncpy(p, "/xawt/libmawt.so", MAXPATHLEN-len-1);
     }
 
     if (toolkit) {
@@ -143,23 +143,12 @@
         (*env)->DeleteLocalRef(env, propname);
     }
 
-    strcat(p, ".so");
-
     JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
                                "(Ljava/lang/String;)V",
                                JNU_NewStringPlatform(env, buf));
 
     awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
 
-/*
-  if (dlsym(awtHandle, "AWTCharRBearing") == NULL) {
-  printf("========= AWTCharRBearing not found\n"); fflush(stdout);
-  }
-  else {
-  printf("========= AWTCharRBearing was found\n"); fflush(stdout);
-  }
-*/
-
     return JNI_VERSION_1_2;
 }