From 7eccfea36f5a30ef5ab55aa1395fe4fbf039f139 Mon Sep 17 00:00:00 2001 From: emiyl Date: Sat, 18 Apr 2026 16:37:20 +0100 Subject: [PATCH] remove trailing null byte --- src/Cafe/CafeSystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index 95e87317..e6ead856 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -473,8 +473,10 @@ namespace CafeSystem if (sysctlbyname("machdep.cpu.brand_string", NULL, &cpu_len, NULL, 0) == 0 && cpu_len > 1) { cpuName.resize(cpu_len); - if (sysctlbyname("machdep.cpu.brand_string", cpuName.data(), &cpu_len, NULL, 0) != 0) + if (sysctlbyname("machdep.cpu.brand_string", cpuName.data(), &cpu_len, NULL, 0) != 0 || cpu_len == 0) cpuName.clear(); + else if (!cpuName.empty() && cpuName.back() == '\0') + cpuName.pop_back(); } #else std::string cpuName = g_CPUFeatures.GetCPUName();