summaryrefslogtreecommitdiffstats
path: root/runtime/debug.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-04-19 15:13:33 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-04-19 15:13:33 +0200
commitada87cbaefecff9d32f3d008876f2eec59335ded (patch)
treec52339b2e2c2cbfc7a7152bf1cc65912b46932c2 /runtime/debug.c
parent11ab3c800043b036132b0fc96d20bcba637a72b6 (diff)
parent9039fad4019cb9a0f96eb296835476841b453dd3 (diff)
downloadrsyslog-ada87cbaefecff9d32f3d008876f2eec59335ded.tar.gz
rsyslog-ada87cbaefecff9d32f3d008876f2eec59335ded.tar.xz
rsyslog-ada87cbaefecff9d32f3d008876f2eec59335ded.zip
Merge branch 'v4-devel' into master
Conflicts: ChangeLog Makefile.am configure.ac doc/manual.html runtime/debug.c runtime/rsyslog.h tests/Makefile.am tests/diag.sh tests/nettester.c tools/syslogd.c
Diffstat (limited to 'runtime/debug.c')
-rw-r--r--runtime/debug.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/runtime/debug.c b/runtime/debug.c
index e7fdf990..899d05da 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -157,7 +157,9 @@ static pthread_key_t keyCallStack;
*/
static void dbgMutexCancelCleanupHdlr(void *pmut)
{
- pthread_mutex_unlock((pthread_mutex_t*) pmut);
+ int ret;
+ ret = pthread_mutex_unlock((pthread_mutex_t*) pmut);
+ assert(ret == 0);
}
@@ -963,6 +965,15 @@ dbgoprint(obj_t *pObj, char *fmt, ...)
va_start(ap, fmt);
lenWriteBuf = vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap);
va_end(ap);
+ if(lenWriteBuf >= sizeof(pszWriteBuf)) {
+ /* prevent buffer overrruns and garbagge display */
+ pszWriteBuf[sizeof(pszWriteBuf) - 5] = '.';
+ pszWriteBuf[sizeof(pszWriteBuf) - 4] = '.';
+ pszWriteBuf[sizeof(pszWriteBuf) - 3] = '.';
+ pszWriteBuf[sizeof(pszWriteBuf) - 2] = '\n';
+ pszWriteBuf[sizeof(pszWriteBuf) - 1] = '\0';
+ lenWriteBuf = sizeof(pszWriteBuf);
+ }
dbgprint(pObj, pszWriteBuf, lenWriteBuf);
}