mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
zld: fix parsing archive/object name from header
This commit is contained in:
parent
96ae451bbe
commit
d1b376cac9
@ -248,8 +248,8 @@ fn getName(allocator: *Allocator, header: ar_hdr, reader: anytype) ![]u8 {
|
|||||||
var n = try allocator.alloc(u8, len);
|
var n = try allocator.alloc(u8, len);
|
||||||
defer allocator.free(n);
|
defer allocator.free(n);
|
||||||
try reader.readNoEof(n);
|
try reader.readNoEof(n);
|
||||||
const actual_len = mem.indexOfScalar(u8, n, @as(u8, 0));
|
const actual_len = mem.indexOfScalar(u8, n, @as(u8, 0)) orelse n.len;
|
||||||
name = try allocator.dupe(u8, n[0..actual_len.?]);
|
name = try allocator.dupe(u8, n[0..actual_len]);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
Loading…
Reference in New Issue
Block a user