From: slaren Date: Thu, 5 Sep 2024 00:19:39 +0000 (+0200) Subject: llama-bench : fix NUL terminators in CPU name (#9313) X-Git-Tag: upstream/0.0.4488~819 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=bdf314f38a2c90e18285f7d7067e8d736a14000a;p=pkg%2Fggml%2Fsources%2Fllama.cpp llama-bench : fix NUL terminators in CPU name (#9313) --- diff --git a/examples/llama-bench/llama-bench.cpp b/examples/llama-bench/llama-bench.cpp index bf97cc68..0c9bcb77 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