Uploaded image for project: 'James Mime4j'
  1. James Mime4j
  2. MIME4J-265

Possible wrong calculation of header length

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7.2
    • None
    • None

    Description

      I've implemented a sort of mail server and I have many threads listening for incoming emails.
      I'm using mime4j to parse javamail Message.

      I had only one case of:
      Caused by: org.apache.james.mime4j.io.MaxHeaderLengthLimitException: Maximum header length limit exceeded
      at org.apache.james.mime4j.stream.DefaultFieldBuilder.append(DefaultFieldBuilder.java:63)
      at org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:212)
      at org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258)

      Looking at the code of DefaultFieldBuilder, it seems that the check over line length is not done on the single line but on the overall header, I'm refering to this line:

      if (this.maxlen > 0 && this.buf.length() + len >= this.maxlen) {
      

      Why should you add "this.buf.length" ?
      I know that there is no limit on header length, but only in its lines.

      I can't attach my eml for privacy reasons but I can confirm that I have no too much long line

      Thanks

      Attachments

        Activity

          People

            Unassigned Unassigned
            Gamby1980 Raffaele Gambelli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: