You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rc...@apache.org on 2019/11/26 10:41:27 UTC

[james-project] 06/06: JAMES-2110 Reduce ImapRequestLineReader::consumeLiteral buffer size

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit d8a4a8c066ea0e38db3e7e503e4a56a58c98e829
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Nov 22 09:11:41 2019 +0700

    JAMES-2110 Reduce ImapRequestLineReader::consumeLiteral buffer size
    
    This method is used by ListCommandParser (list of mailboxes), Set Annotation
    command parser, in search command parser, setAcl, deleteAcl,
    loginCommandParser, listRight, enable, authenticate.
    
    Usage also includes parsing mailbox names.
    
    0xFFFF means 64KB and is a big size for such purposes, I propose to
    decrease that buffer size tpo a more reasonable 2KB value, that should
    be more than enough regarding the aforementioned usages.
---
 .../main/java/org/apache/james/imap/decode/ImapRequestLineReader.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
index ab65ce3..b4f5e75 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java
@@ -371,7 +371,7 @@ public abstract class ImapRequestLineReader {
         } else {
             try (FastByteArrayOutputStream out = new FastByteArrayOutputStream();
                  InputStream in = consumeLiteral(false)) {
-                IOUtils.copy(in, out, 0xFFFF);
+                IOUtils.copy(in, out, 2048);
                 byte[] bytes = out.toByteArray();
                 ByteBuffer buffer = ByteBuffer.wrap(bytes);
                 return decode(charset, buffer);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org