mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8144197: Possible use after free in Arguments::add_property function
Reviewed-by: dholmes, goetz
This commit is contained in:
parent
30603c6599
commit
f9b7fc0201
1 changed files with 9 additions and 7 deletions
|
@ -1308,18 +1308,20 @@ bool Arguments::add_property(const char* prop) {
|
||||||
PropertyList_unique_add(&_system_properties, key, value, true);
|
PropertyList_unique_add(&_system_properties, key, value, true);
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(key, "sun.java.command") == 0) {
|
if (strcmp(key, "sun.java.command") == 0) {
|
||||||
if (_java_command != NULL) {
|
char *old_java_command = _java_command;
|
||||||
os::free(_java_command);
|
|
||||||
}
|
|
||||||
_java_command = os::strdup_check_oom(value, mtInternal);
|
_java_command = os::strdup_check_oom(value, mtInternal);
|
||||||
} else if (strcmp(key, "java.vendor.url.bug") == 0) {
|
if (old_java_command != NULL) {
|
||||||
if (_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) {
|
os::free(old_java_command);
|
||||||
assert(_java_vendor_url_bug != NULL, "_java_vendor_url_bug is NULL");
|
|
||||||
os::free((void *)_java_vendor_url_bug);
|
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(key, "java.vendor.url.bug") == 0) {
|
||||||
|
const char* old_java_vendor_url_bug = _java_vendor_url_bug;
|
||||||
// save it in _java_vendor_url_bug, so JVM fatal error handler can access
|
// save it in _java_vendor_url_bug, so JVM fatal error handler can access
|
||||||
// its value without going through the property list or making a Java call.
|
// its value without going through the property list or making a Java call.
|
||||||
_java_vendor_url_bug = os::strdup_check_oom(value, mtInternal);
|
_java_vendor_url_bug = os::strdup_check_oom(value, mtInternal);
|
||||||
|
if (old_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) {
|
||||||
|
assert(old_java_vendor_url_bug != NULL, "_java_vendor_url_bug is NULL");
|
||||||
|
os::free((void *)old_java_vendor_url_bug);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new property and add at the end of the list
|
// Create new property and add at the end of the list
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue