Skip to content

Commit bdf314f

Browse files
authored
llama-bench : fix NUL terminators in CPU name (#9313)
1 parent 581c305 commit bdf314f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/llama-bench/llama-bench.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ static std::string get_cpu_info() {
124124
(LPBYTE)cpu_brand,
125125
&cpu_brand_size) == ERROR_SUCCESS) {
126126
id.assign(cpu_brand, cpu_brand_size);
127+
if (id.find('\0') != std::string::npos) {
128+
id.resize(id.find('\0'));
129+
}
127130
}
128131
RegCloseKey(hKey);
129132
#endif

0 commit comments

Comments
 (0)