From d1b376cac92da5eb6b34899ab68ef73d5ea740b8 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Fri, 19 Mar 2021 08:46:43 +0100 Subject: [PATCH] zld: fix parsing archive/object name from header --- src/link/MachO/Archive.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/link/MachO/Archive.zig b/src/link/MachO/Archive.zig index 8fa0457a16..1dcd894c9a 100644 --- a/src/link/MachO/Archive.zig +++ b/src/link/MachO/Archive.zig @@ -248,8 +248,8 @@ fn getName(allocator: *Allocator, header: ar_hdr, reader: anytype) ![]u8 { var n = try allocator.alloc(u8, len); defer allocator.free(n); try reader.readNoEof(n); - const actual_len = mem.indexOfScalar(u8, n, @as(u8, 0)); - name = try allocator.dupe(u8, n[0..actual_len.?]); + const actual_len = mem.indexOfScalar(u8, n, @as(u8, 0)) orelse n.len; + name = try allocator.dupe(u8, n[0..actual_len]); }, } return name;