summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-01 16:54:34 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-01 16:54:34 +0200
commitcb9761627630dc8aeafbbfcfe091f87b66b5a92a (patch)
treed3db6668c167d0354bfdd3a1423f2e9da39c1175 /tools
parente13537ce909e8e6ab0b9d404c1e4870980c6dacf (diff)
downloadrsyslog-cb9761627630dc8aeafbbfcfe091f87b66b5a92a.tar.gz
rsyslog-cb9761627630dc8aeafbbfcfe091f87b66b5a92a.tar.xz
rsyslog-cb9761627630dc8aeafbbfcfe091f87b66b5a92a.zip
RFC5424 formatted messages with only structured data and no MSG part were improperly handled.
This was a regression of one of the last bugfixes, so no previously released version contained this bug (thus it does not show up in the ChangeLog).
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 5671dcde..5f6b480f 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1320,9 +1320,17 @@ static int parseRFCStructuredData(uchar **pp2parse, uchar *pResult, int *pLenStr
} else {
while(bCont) {
if(lenStr < 2) {
- iRet = 1; /* this is not valid! */
- bCont = 0;
- } else if(*p2parse == '\\' && *(p2parse+1) == ']') {
+ /* we now need to check if we have only structured data */
+ if(lenStr > 0 && *p2parse == ']') {
+ *pResult++ = *p2parse;
+ p2parse++;
+ lenStr--;
+ bCont = 0;
+ } else {
+ iRet = 1; /* this is not valid! */
+ bCont = 0;
+ }
+ } else if(*p2parse == '\\' && *(p2parse+1) == ']') {
/* this is escaped, need to copy both */
*pResult++ = *p2parse++;
*pResult++ = *p2parse++;
@@ -1382,7 +1390,7 @@ int parseRFCSyslogMsg(msg_t *pMsg, int flags)
assert(pMsg != NULL);
assert(pMsg->pszRawMsg != NULL);
p2parse = pMsg->pszRawMsg + pMsg->offAfterPRI; /* point to start of text, after PRI */
- lenMsg = pMsg->iLenRawMsg - (pMsg->offAfterPRI + 1);
+ lenMsg = pMsg->iLenRawMsg - pMsg->offAfterPRI;
/* do a sanity check on the version and eat it (the caller checked this already) */
assert(p2parse[0] == '1' && p2parse[1] == ' ');