diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 5767291de7..df50b4a4c2 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -232,7 +232,7 @@ pub const NativeTargetInfo = struct { // supports std.os.sysctlbynameC( "kern.osproductversion", - &product_version[0], + &product_version, &size, null, 0, @@ -241,7 +241,8 @@ pub const NativeTargetInfo = struct { else => unreachable, }; - if (std.builtin.Version.parse(product_version[0..size])) |ver| { + const string_version = product_version[0 .. size - 1 :0]; + if (std.builtin.Version.parse(string_version)) |ver| { os.version_range.semver.min = ver; os.version_range.semver.max = ver; } else |err| switch (err) {