Client.recvPacket — DoS via 4 GB allocationClient.recvPacket — DoS via 4 GB allocationFile: src/client/client.zig:63–68
Severity: HIGH
Status: ✅ FIXED — added MAX_PACKET_SIZE = 1 MiB cap; oversized lengths return PacketTooLarge. Unit test added.
const len = std.mem.readInt(u32, hdr[0..4], .little);
if (len < 5) return error.InvalidPacket;
const body_len = len - 5;
const body = try self.allocator.alloc(u8, body_len); // no max cap
A malicious server can send len = 0xFFFFFFFF, causing a 4 GB allocation attempt. Should cap to a reasonable maximum (e.g. 1 MiB).