From 3cffae7e763459d00316e73c623cab10a03dab95 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 15 Sep 2022 15:53:51 -0700 Subject: [PATCH] util.git_rev_HEAD: max alloc len to 50 --- src/util/funcs.zig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/util/funcs.zig b/src/util/funcs.zig index 4a82a2ae11c67f7bf09bf734f8dae92893c3947e..e5104355dda6a3f452f595244133dd48df40552a 100644 --- a/src/util/funcs.zig +++ b/src/util/funcs.zig @@ -231,10 +231,9 @@ pub fn do_hash(alloc: std.mem.Allocator, comptime algo: type, data: string) !str /// Returns the result of running `git rev-parse HEAD` pub fn git_rev_HEAD(alloc: std.mem.Allocator, dir: std.fs.Dir) !string { - const max = std.math.maxInt(usize); const dirg = try dir.openDir(".git", .{}); - const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", max), "\n"); - const r = std.mem.trim(u8, try dirg.readFileAlloc(alloc, h[5..], max), "\n"); + const h = std.mem.trim(u8, try dirg.readFileAlloc(alloc, "HEAD", 50), "\n"); + const r = std.mem.trim(u8, try dirg.readFileAlloc(alloc, h[5..], 50), "\n"); return r; } -- 2.54.0