diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-10-13 08:15:54 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-10-13 08:15:54 +0200 |
commit | d6a6666b66733e63255f806dd272a0b85e0f0c13 (patch) | |
tree | d4c22d814c9dde486cc1ccf6da9c507817791ccf | |
parent | 4831a51f5a7c8e3821cb98bc21fb47204e5470c2 (diff) | |
download | rsyslog-d6a6666b66733e63255f806dd272a0b85e0f0c13.tar.gz rsyslog-d6a6666b66733e63255f806dd272a0b85e0f0c13.tar.xz rsyslog-d6a6666b66733e63255f806dd272a0b85e0f0c13.zip |
bugfix: race condition when extracting structured data and PROCID
same issue as previous commit for PROGNAME and APPNAME
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | runtime/msg.c | 24 |
2 files changed, 25 insertions, 5 deletions
@@ -1,7 +1,9 @@ --------------------------------------------------------------------------- Version 5.8.6 [V5-stable] 2011-??-?? -- bugfix: race condition when extracting program name and APPNAME - could lead to invalid characters e.g. in dynamic file names +- bugfix: race condition when extracting program name, APPNAME, structured + data and PROCID (RFC5424 fields) could lead to invalid characters e.g. + in dynamic file names or during forwarding (general malfunction of these + fields in templates, mostly under heavy load) - bugfix: imuxsock did no longer ignore message-provided timestamp, if so configured (the *default*). Lead to no longer sub-second timestamps. closes: http://bugzilla.adiscon.com/show_bug.cgi?id=281 diff --git a/runtime/msg.c b/runtime/msg.c index eb1e3ae4..0744edd5 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1605,9 +1605,19 @@ static inline int getPROCIDLen(msg_t *pM, sbool bLockMutex) */ char *getPROCID(msg_t *pM, sbool bLockMutex) { + uchar *pszRet; + ISOBJ_TYPE_assert(pM, msg); - preparePROCID(pM, bLockMutex); - return (pM->pCSPROCID == NULL) ? "-" : (char*) cstrGetSzStrNoNULL(pM->pCSPROCID); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + preparePROCID(pM, MUTEX_ALREADY_LOCKED); + if(pM->pCSPROCID == NULL) + pszRet = UCHAR_CONSTANT(""); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSPROCID); + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); + return (char*) pszRet; } @@ -1834,7 +1844,15 @@ static int getStructuredDataLen(msg_t *pM) */ static inline char *getStructuredData(msg_t *pM) { - return (pM->pCSStrucData == NULL) ? "-" : (char*) rsCStrGetSzStrNoNULL(pM->pCSStrucData); + uchar *pszRet; + + MsgUnlock(pM); + if(pM->pCSStrucData == NULL) + pszRet = UCHAR_CONSTANT("-"); + else + pszRet = rsCStrGetSzStrNoNULL(pM->pCSStrucData); + MsgUnlock(pM); + return (char*) pszRet; } |