8030763: Validate global memory allocation

Add length checks where necessary

Reviewed-by: coleenp, mschoene
This commit is contained in:
Harold Seigel 2014-07-14 12:43:50 +04:00
parent 5323c1c179
commit 7ec22758dc
7 changed files with 11 additions and 30 deletions

View file

@ -1543,9 +1543,6 @@ void os::die() {
::abort(); // dump core (for debugging)
}
// unused
void os::set_error_file(const char *logfile) {}
// DLL functions
const char* os::dll_file_extension() { return ".so"; }
@ -2185,6 +2182,7 @@ void os::jvm_path(char *buf, jint buflen) {
// determine if this is a legacy image or modules image
// modules image doesn't have "jre" subdirectory
len = strlen(buf);
assert(len < buflen, "Ran out of buffer space");
jrelib_p = buf + len;
snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
if (0 != access(buf, F_OK)) {
@ -2203,7 +2201,7 @@ void os::jvm_path(char *buf, jint buflen) {
}
}
strcpy(saved_jvm_path, buf);
strncpy(saved_jvm_path, buf, MAXPATHLEN);
}