From 95540feb55e3c013daafb090cf192685e05048cc Mon Sep 17 00:00:00 2001 From: utox39 Date: Sat, 1 Mar 2025 18:47:29 +0100 Subject: [PATCH] fix: fix incorrect size of cpu name --- src/macos/macos.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/macos/macos.zig b/src/macos/macos.zig index 88fb9c4..241ddca 100644 --- a/src/macos/macos.zig +++ b/src/macos/macos.zig @@ -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) {