Mercurial > hg > graal-compiler
diff src/os/windows/vm/os_windows.cpp @ 17567:5656140324ed
8030763: Validate global memory allocation
Summary: Add length checks where necessary
Reviewed-by: coleenp, mschoene
author | hseigel |
---|---|
date | Thu, 13 Feb 2014 11:28:17 -0500 |
parents | 179cd89fb279 |
children | 3eed8712d410 364b73402247 |
line wrap: on
line diff
--- a/src/os/windows/vm/os_windows.cpp Wed Feb 12 11:33:30 2014 -0800 +++ b/src/os/windows/vm/os_windows.cpp Thu Feb 13 11:28:17 2014 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1819,7 +1819,8 @@ // libjvm.so is installed there (append a fake suffix // hotspot/libjvm.so). 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); @@ -1837,9 +1838,9 @@ } if(buf[0] == '\0') { - GetModuleFileName(vm_lib_handle, buf, buflen); - } - strcpy(saved_jvm_path, buf); + GetModuleFileName(vm_lib_handle, buf, buflen); + } + strncpy(saved_jvm_path, buf, MAX_PATH); } @@ -2290,19 +2291,8 @@ } */ -#endif //_WIN64 - - -// 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); - } -} +#endif // _WIN64 + static inline void report_error(Thread* t, DWORD exception_code, address addr, void* siginfo, void* context) {