--- a/src/hotspot/share/classfile/modules.cpp Thu Feb 07 02:48:11 2019 +0100
+++ b/src/hotspot/share/classfile/modules.cpp Wed Feb 06 18:34:12 2019 -0800
@@ -334,8 +334,8 @@
(package_name[JAVAPKG_LEN] == '/' || package_name[JAVAPKG_LEN] == '\0'))) {
const char* class_loader_name = loader_data->loader_name_and_id();
size_t pkg_len = strlen(package_name);
- char* pkg_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, pkg_len);
- strncpy(pkg_name, package_name, pkg_len);
+ char* pkg_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, pkg_len + 1);
+ strncpy(pkg_name, package_name, pkg_len + 1);
StringUtils::replace_no_expand(pkg_name, "/", ".");
const char* msg_text1 = "Class loader (instance of): ";
const char* msg_text2 = " tried to define prohibited package name: ";