diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-12 09:10:19 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-12 09:10:19 +0200 |
commit | 25bc3b2e30deaee00fcf183e885378a0d64ae94c (patch) | |
tree | 9003917ec023600f4e2916a5907d5a35856b928e /runtime/debug.c | |
parent | 62e00d7a1c1d0301d50e7a28cb84563d61410ecd (diff) | |
parent | 5ef852f4a3f030f61254a963b0d2dca290933e3c (diff) | |
download | rsyslog-25bc3b2e30deaee00fcf183e885378a0d64ae94c.tar.gz rsyslog-25bc3b2e30deaee00fcf183e885378a0d64ae94c.tar.xz rsyslog-25bc3b2e30deaee00fcf183e885378a0d64ae94c.zip |
Merge branch 'v4-stable-solaris' into v4-devel
Conflicts:
ChangeLog
configure.ac
doc/manual.html
tools/omfile.c
tools/syslogd.c
Diffstat (limited to 'runtime/debug.c')
-rw-r--r-- | runtime/debug.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/runtime/debug.c b/runtime/debug.c index c23dec3b..c82a411d 100644 --- a/runtime/debug.c +++ b/runtime/debug.c @@ -1,4 +1,3 @@ -#include <sys/syscall.h> /* debug.c * * This file proides debug and run time error analysis support. Some of the @@ -550,6 +549,7 @@ if(pLog == NULL) { return; /* if we don't know it yet, we can not clean up... */ } #endif +#include <sys/syscall.h> /* we found the last lock entry. We now need to see from which FuncDB we need to * remove it. This is recorded inside the mutex log entry. @@ -922,7 +922,7 @@ void dbgoprint(obj_t *pObj, char *fmt, ...) { va_list ap; - char pszWriteBuf[1024]; + char pszWriteBuf[32*1024]; size_t lenWriteBuf; if(!(Debug && debugging_on)) @@ -952,7 +952,7 @@ void dbgprintf(char *fmt, ...) { va_list ap; - char pszWriteBuf[1024]; + char pszWriteBuf[20480]; size_t lenWriteBuf; if(!(Debug && debugging_on)) @@ -961,6 +961,15 @@ dbgprintf(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(NULL, pszWriteBuf, lenWriteBuf); } |