mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
Reviewed-by: kbarrett, rehn
This commit is contained in:
parent
46666a2d94
commit
15d554b395
12 changed files with 59 additions and 73 deletions
|
@ -2454,9 +2454,15 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
|||
(is_absolute_path = match_option(option, "-agentpath:", &tail))) {
|
||||
if(tail != NULL) {
|
||||
const char* pos = strchr(tail, '=');
|
||||
size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
|
||||
char* name = strncpy(NEW_C_HEAP_ARRAY(char, len + 1, mtArguments), tail, len);
|
||||
name[len] = '\0';
|
||||
char* name;
|
||||
if (pos == NULL) {
|
||||
name = os::strdup_check_oom(tail, mtArguments);
|
||||
} else {
|
||||
size_t len = pos - tail;
|
||||
name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments);
|
||||
memcpy(name, tail, len);
|
||||
name[len] = '\0';
|
||||
}
|
||||
|
||||
char *options = NULL;
|
||||
if(pos != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue