You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/01/21 18:58:39 UTC

[jira] [Created] (LOG4J2-1260) TlsSyslogFrame calculates message length incorrectly

Gary Gregory created LOG4J2-1260:
------------------------------------

             Summary: TlsSyslogFrame calculates message length incorrectly
                 Key: LOG4J2-1260
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1260
             Project: Log4j 2
          Issue Type: Bug
          Components: Layouts
    Affects Versions: 2.5
            Reporter: Gary Gregory


TlsSyslogFrame calculates message length incorrectly.

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

{quote}
---------- Forwarded message ----------
From: Blake Day <bl...@chewy.com>
Date: Wed, Jan 20, 2016 at 4:58 PM
Subject: TlsSyslogFrame calculates message length incorrectly
To: Log4J Users List <lo...@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;
}
{quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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