From bdf314f38a2c90e18285f7d7067e8d736a14000a Mon Sep 17 00:00:00 2001 From: slaren Date: Thu, 5 Sep 2024 02:19:39 +0200 Subject: [PATCH] llama-bench : fix NUL terminators in CPU name (#9313) --- examples/llama-bench/llama-bench.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/llama-bench/llama-bench.cpp b/examples/llama-bench/llama-bench.cpp index bf97cc684..0c9bcb777 100644 --- a/examples/llama-bench/llama-bench.cpp +++ b/examples/llama-bench/llama-bench.cpp @@ -124,6 +124,9 @@ static std::string get_cpu_info() { (LPBYTE)cpu_brand, &cpu_brand_size) == ERROR_SUCCESS) { id.assign(cpu_brand, cpu_brand_size); + if (id.find('\0') != std::string::npos) { + id.resize(id.find('\0')); + } } RegCloseKey(hKey); #endif