From b4d4366986b464ae4a75594ab7df0a5edb2ee08f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 11 Aug 2011 15:05:00 +0200 Subject: bugfixes for tag emulation - bugfix: potential hang condition during tag emulation - bugfix: too-early string termination during tag emulation --- ChangeLog | 4 +++- runtime/msg.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71ac7448..92d582fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- -Version 5.8.5 [V5-stable] (al), 2011-??-?? +Version 5.8.5 [V5-stable] (rgerhards/al), 2011-??-?? +- bugfix: potential hang condition during tag emulation +- bugfix: too-early string termination during tag emulation - bugfix: The NUL-Byte for the syslogtag was not copied in MsgDup (msg.c) --------------------------------------------------------------------------- Version 5.8.4 [V5-stable] (al), 2011-08-10 diff --git a/runtime/msg.c b/runtime/msg.c index 9fdaded3..b18fb530 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1697,8 +1697,11 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex) if(bLockMutex == LOCK_MUTEX) MsgLock(pM); - if(pM->iLenTAG > 0) + if(pM->iLenTAG > 0) { + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); return; /* done, no need to emulate */ + } if(getProtocolVersion(pM) == 1) { if(!strcmp(getPROCID(pM, MUTEX_ALREADY_LOCKED), "-")) { @@ -1708,7 +1711,7 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex) /* now we can try to emulate */ lenTAG = snprintf((char*)bufTAG, CONF_TAG_MAXSIZE, "%s[%s]", getAPPNAME(pM, MUTEX_ALREADY_LOCKED), getPROCID(pM, MUTEX_ALREADY_LOCKED)); - bufTAG[32] = '\0'; /* just to make sure... */ + bufTAG[sizeof(bufTAG)-1] = '\0'; /* just to make sure... */ MsgSetTAG(pM, bufTAG, lenTAG); } } -- cgit v1.2.3 From e54e8724767e938c028823a42e3f54820067cfcd Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 12 Aug 2011 10:18:51 +0200 Subject: minor doc: made body tag parsable for web site scripts --- doc/rsyslog_pgsql.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/rsyslog_pgsql.html b/doc/rsyslog_pgsql.html index dcb9dc3a..21516ec8 100644 --- a/doc/rsyslog_pgsql.html +++ b/doc/rsyslog_pgsql.html @@ -30,7 +30,7 @@ --> - +

Writing syslog messages to MySQL, PostgreSQL or any other supported Database

Written by Rainer @@ -333,4 +333,4 @@ Gerhards, Marc Schiffbauer and Adiscon<



- \ No newline at end of file + -- cgit v1.2.3 From 169791752520693d3c81568037bfa319e5081819 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 12 Aug 2011 14:48:43 +0200 Subject: Added debug output into message parsers needed for bugtracking Changed version to 5.8.5-pre1 --- configure.ac | 2 +- runtime/msg.c | 5 +++++ tools/pmrfc3164.c | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2706ec06..7ed85851 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[5.8.4],[rsyslog@lists.adiscon.com]) +AC_INIT([rsyslog],[5.8.5-pre1],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/runtime/msg.c b/runtime/msg.c index b18fb530..f1de8130 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1661,6 +1661,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf) uchar *pBuf; assert(pMsg != NULL); +dbgprintf("MsgSetTAG in: len %d, pszBuf: %s\n", lenBuf, pszBuf); + freeTAG(pMsg); pMsg->iLenTAG = lenBuf; @@ -1679,6 +1681,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf) memcpy(pBuf, pszBuf, pMsg->iLenTAG); pBuf[pMsg->iLenTAG] = '\0'; /* this also works with truncation! */ + +dbgprintf("MsgSetTAG exit: pMsg->iLenTAG %d, pMsg->TAG.szBuf: %s\n", pMsg->iLenTAG, pMsg->TAG.szBuf); } @@ -1737,6 +1741,7 @@ getTAG(msg_t *pM, uchar **ppBuf, int *piLen) *piLen = pM->iLenTAG; } } +dbgprintf("getTAG: len %d, buf '%s'\n", *piLen, *ppBuf); } diff --git a/tools/pmrfc3164.c b/tools/pmrfc3164.c index 635ca985..d56e53f0 100644 --- a/tools/pmrfc3164.c +++ b/tools/pmrfc3164.c @@ -176,6 +176,7 @@ CODESTARTparse * in RFC3164...). We now receive the full size, but will modify the * outputs so that only 32 characters max are used by default. */ +dbgprintf("pmrfc3164:tag:in: lenMsg %d, p2parse: '%s'\n", lenMsg, p2parse); i = 0; while(lenMsg > 0 && *p2parse != ':' && *p2parse != ' ' && i < CONF_TAG_MAXSIZE) { bufParseTAG[i++] = *p2parse++; @@ -191,6 +192,7 @@ CODESTARTparse * is considered OK. So we do not need to check for empty TAG. -- rgerhards, 2009-06-23 */ bufParseTAG[i] = '\0'; /* terminate string */ +dbgprintf("pmrfc3164:tag:done: lenMsg %d, i %d, bufParseTAG: '%s'\n", lenMsg, i, bufParseTAG); MsgSetTAG(pMsg, bufParseTAG, i); } else {/* we enter this code area when the user has instructed rsyslog NOT * to parse HOSTNAME and TAG - rgerhards, 2006-03-13 -- cgit v1.2.3