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 --- runtime/msg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime/msg.c') 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 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 --- runtime/msg.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/msg.c') 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); } -- cgit v1.2.3