--- old/src/share/vm/prims/jni.cpp 2014-04-03 14:47:14.287703528 +0200 +++ new/src/share/vm/prims/jni.cpp 2014-04-03 14:47:14.066970107 +0200 @@ -3150,11 +3150,9 @@ } else { //%note jni_7 if (len > 0) { - ResourceMark rm(THREAD); - char *utf_region = java_lang_String::as_utf8_string(s, start, len); - int utf_len = (int)strlen(utf_region); - memcpy(buf, utf_region, utf_len); - buf[utf_len] = 0; + // Assume the buffer is large enough as the JNI spec. does not require user error checking + java_lang_String::as_utf8_string(s, start, len, buf, INT_MAX); + // as_utf8_string null-terminates the result string } else { // JDK null-terminates the buffer even in len is zero if (buf != NULL) {