processInput — unbounded esc_buf growth on malformed or never-completing CSIprocessInput — unbounded esc_buf growth on malformed or never-completing CSIFile: src/server/server.zig:538–539,595–598
Severity: LOW
Status: ✅ FIXED — Added 1024-byte capacity check and reset mechanism on esc_buf.
var esc_buf: std.ArrayList(u8) = .empty;
defer esc_buf.deinit(self.allocator);
while (i < buf.len) : (i += 1) {
const byte = buf[i];
...
if (self.input_reader.state != .ground or byte == 0x1b or byte < 0x20) {
try esc_buf.append(self.allocator, byte);
If an attacker sends a stream of never-terminated escape sequences (e.g. \e[1;2;3;4;5;6;7;... with no final byte), esc_buf grows without bound. Each processInput call processes one 4KB block from handleStdin. Within that block, bytes keep appending to esc_buf. While limited to one 4KB stdin read per call, a burst of CSI sequences with many parameters could push esc_buf to OOM territory. No max size check exists.