diff -r 92dc8bd62c69 -r 9f471b837330 hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Fri Jul 11 09:14:21 2014 -0700 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Mon Jul 14 12:43:50 2014 +0400 @@ -1824,7 +1824,9 @@ // looks like jvm.dll is installed there (append a fake suffix // hotspot/jvm.dll). char* java_home_var = ::getenv("JAVA_HOME"); - if (java_home_var != NULL && java_home_var[0] != 0) { + if (java_home_var != NULL && java_home_var[0] != 0 && + strlen(java_home_var) < (size_t)buflen) { + strncpy(buf, java_home_var, buflen); // determine if this is a legacy image or modules image @@ -1843,7 +1845,7 @@ if (buf[0] == '\0') { GetModuleFileName(vm_lib_handle, buf, buflen); } - strcpy(saved_jvm_path, buf); + strncpy(saved_jvm_path, buf, MAX_PATH); } @@ -2291,17 +2293,6 @@ return EXCEPTION_CONTINUE_SEARCH; } -// Fatal error reporting is single threaded so we can make this a -// static and preallocated. If it's more than MAX_PATH silently ignore -// it. -static char saved_error_file[MAX_PATH] = {0}; - -void os::set_error_file(const char *logfile) { - if (strlen(logfile) <= MAX_PATH) { - strncpy(saved_error_file, logfile, MAX_PATH); - } -} - static inline void report_error(Thread* t, DWORD exception_code, address addr, void* siginfo, void* context) { VMError err(t, exception_code, addr, siginfo, context);