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
--- 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 {