From af8d3fb21ab59104d49bd664f634399fb72ecbd2 Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Thu, 12 Jan 2023 01:54:11 +0000 Subject: [PATCH] 8264684: os::get_summary_cpu_info padded with spaces Reviewed-by: iklam, ccheung --- src/hotspot/os/windows/os_windows.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 7cab20c7df0..1d2954014a3 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -1888,6 +1888,10 @@ void os::get_summary_cpu_info(char* buf, size_t buflen) { status = RegQueryValueEx(key, "ProcessorNameString", NULL, NULL, (byte*)buf, &size); if (status != ERROR_SUCCESS) { strncpy(buf, "## __CPU__", buflen); + } else { + if (size < buflen) { + buf[size] = '\0'; + } } RegCloseKey(key); } else {