Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1260

TlsSyslogFrame calculates message length incorrectly

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5
    • 2.6
    • Layouts
    • None

    Description

      TlsSyslogFrame calculates message length incorrectly.

      From the ML https://www.mail-archive.com/log4j-user@logging.apache.org/msg15386.html

      ---------- Forwarded message ----------
      From: Blake Day <blake@chewy.com>
      Date: Wed, Jan 20, 2016 at 4:58 PM
      Subject: TlsSyslogFrame calculates message length incorrectly
      To: Log4J Users List <log4j-user@logging.apache.org>

      TlsSyslogFrame appears to be miscalculating the message length. According to RFC5425, the message length must be the octet count of the SYSLOG-MSG in the frame. Though the variable below is aptly named messageLengthInBytes, it is assigned the value from message.length() (where message is a String) rather than the bytes.

      See below for relevant portions of code:

      private String message;
      private int messageLengthInBytes;

      private void setLengthInBytes() {
      messageLengthInBytes = message.length();
      }

      @Override
      public String toString() {
      final String length = Integer.toString(messageLengthInBytes);
      return length + Chars.SPACE + message;
      }

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ggregory Gary D. Gregory
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment