From dde4979f59bec754b7909a81a40763850f3c29c0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 12:38:55 -0300 Subject: idioms #5, more formats that cannot overflow: /proc paths of a pid, the daemon's pty, close and clients words, a pid or a serial for the environment, a capture's header and status line and a cache's .new name are catch unreachable with their reason, where a catch return, null or continue stood for an overflow no buffer here can have Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Db.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Db.zig') diff --git a/src/Db.zig b/src/Db.zig index 27557ac4..f0bfc3f5 100644 --- a/src/Db.zig +++ b/src/Db.zig @@ -1115,7 +1115,7 @@ pub const Cache = struct { }{ .cap = c.cap, .went = &went }) catch return; if (!went) return; var new_buf: [4200]u8 = undefined; - const new = std.fmt.bufPrint(&new_buf, "{s}.new", .{c.path()}) catch return; + const new = std.fmt.bufPrint(&new_buf, "{s}.new", .{c.path()}) catch unreachable; // a path of 4096 fits 4200 const cwd = std.Io.Dir.cwd(); const file = cwd.createFile(io, new, .{ .read = true, .truncate = true }) catch return; var buffer: std.Io.Writer.Allocating = .init(std.heap.c_allocator); -- cgit v1.3