File: src/cmd/cmd.zig:516-538 (cf. cmdPasteBuffer, cmd.zig:471)
Severity: MEDIUM
Status: ✅ FIXED
cmdLoadBuffer’s read loop now aborts with .err + a status-line message once
the accumulated size would exceed Server.MAX_PASTE_SIZE (the same cap the
paste path enforces).
Test: load-buffer enforces MAX_PASTE_SIZE — bug #382
(writes a >16 KiB temp file, expects error and an untouched buffer stack).
Note: distinct from bug #357 (invalid free at the same site)
The read loop appends until EOF with no limit:
while (true) {
const n = std.c.read(fd, &chunk, chunk.len);
...
data.appendSlice(server.allocator, chunk[0..n]) catch return .err;
}
loadb /dev/zero grows until OOM.
Abort with .err once accumulated size exceeds MAX_PASTE_SIZE, matching the
paste path.