The net-imap Ruby gem has a vulnerability that may allow a denial of service (DoS) via memory exhaustion when reading server responses containing large literal byte counts. A malicious or compromised IMAP server can specify an arbitrarily large literal size, causing the client to allocate excessive memory. This issue primarily affects connections to untrusted or insecure servers. The vulnerability is fixed in net-imap versions 0.5.7, 0.4.20, 0.3.9, and 0.2.5 by introducing a configurable max_response_size limit to restrict the size of literals processed per response.