diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-08-11 15:05:00 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-08-11 15:05:00 +0200 |
commit | b4d4366986b464ae4a75594ab7df0a5edb2ee08f (patch) | |
tree | fabef4fcfe3892ed276e34361727dadde9971f56 /runtime | |
parent | 00d594348af514fbbbb5f581124ac524d507187f (diff) | |
download | rsyslog-b4d4366986b464ae4a75594ab7df0a5edb2ee08f.tar.gz rsyslog-b4d4366986b464ae4a75594ab7df0a5edb2ee08f.tar.xz rsyslog-b4d4366986b464ae4a75594ab7df0a5edb2ee08f.zip |
bugfixes for tag emulation
- bugfix: potential hang condition during tag emulation
- bugfix: too-early string termination during tag emulation
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 7 |
1 files changed, 5 insertions, 2 deletions
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); } } |