8297874: get_dump_directory() in jfrEmergencyDump.cpp should pass correct length to jio_snprintf

Reviewed-by: mgronlun
This commit is contained in:
Calvin Cheung 2023-01-10 17:09:52 +00:00
parent a86b6f6fde
commit 5a51ef22ad

View File

@ -78,7 +78,7 @@ static size_t get_dump_directory() {
}
const size_t path_len = strlen(_path_buffer);
const int result = jio_snprintf(_path_buffer + path_len,
sizeof(_path_buffer),
sizeof(_path_buffer) - path_len,
"%s",
os::file_separator());
return (result == -1) ? 0 : strlen(_path_buffer);