fix: fix incorrect size of cpu name

This commit is contained in:
utox39
2025-03-01 18:47:29 +01:00
parent 74b4e44e98
commit 95540feb55

View File

@@ -96,7 +96,7 @@ pub fn getCpuInfo(allocator: std.mem.Allocator) !CpuInfo {
return error.FailedToGetCpuNameSize;
}
const cpu_name: []u8 = try allocator.alloc(u8, size);
const cpu_name: []u8 = try allocator.alloc(u8, size - 1);
// Second call to sysctlbyname to get the CPU name
if (c_sysctl.sysctlbyname("machdep.cpu.brand_string", cpu_name.ptr, &size, null, 0) != 0) {