8060721: Test runtime/SharedArchiveFile/LimitSharedSizes.java fails in jdk 9 fcs new platforms/compiler
authorccheung
Mon, 10 Nov 2014 10:13:10 -0800
changeset 27611 e8e7b0902deb
parent 27610 ff5715ccba0d
child 27612 7201412afbd0
child 27619 72646ac2d0d3
8060721: Test runtime/SharedArchiveFile/LimitSharedSizes.java fails in jdk 9 fcs new platforms/compiler Summary: replaced strcat() with jio_snprintf() Reviewed-by: dholmes, iklam, dlong, minqi
hotspot/src/share/vm/memory/metaspaceShared.cpp
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Nov 07 12:48:09 2014 -0800
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Mon Nov 10 10:13:10 2014 -0800
@@ -715,15 +715,17 @@
     if (class_list_path_len >= 3) {
       if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) {
         if (class_list_path_len < JVM_MAXPATHLEN - 4) {
-          strncat(class_list_path_str, os::file_separator(), 1);
-          strncat(class_list_path_str, "lib", 3);
+          jio_snprintf(class_list_path_str + class_list_path_len,
+                       sizeof(class_list_path_str) - class_list_path_len,
+                       "%slib", os::file_separator());
+          class_list_path_len += 4;
         }
       }
     }
-    class_list_path_len = (int)strlen(class_list_path_str);
     if (class_list_path_len < JVM_MAXPATHLEN - 10) {
-      strncat(class_list_path_str, os::file_separator(), 1);
-      strncat(class_list_path_str, "classlist", 9);
+      jio_snprintf(class_list_path_str + class_list_path_len,
+                   sizeof(class_list_path_str) - class_list_path_len,
+                   "%sclasslist", os::file_separator());
     }
     class_list_path = class_list_path_str;
   } else {