8333178: ubsan: jvmti_tools.cpp:149:16: runtime error: null pointer passed as argument 2, which is declared to never be null

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Matthias Baesken 2024-06-06 07:46:35 +00:00
parent c7d2841fb4
commit 880c6b42ba

View File

@ -146,7 +146,9 @@ static int add_option(const char opt[], int opt_len, const char val[], int val_l
} else {
strncpy(name, opt, opt_len);
name[opt_len] = '\0';
strncpy(value, val, val_len);
if (val != nullptr) {
strncpy(value, val, val_len);
}
value[val_len] = '\0';
if (!check_option(dashed_opt, name, value)) {