From dbb50ec360556c0d4402808bf326c38831ff1734 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 27 Mar 2008 15:49:09 +0000 Subject: bugfix: $ModDir did invalid bounds checking, potential overlow in dbgprintf() - thanks to varmojfekoj for the patch --- debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'debug.c') diff --git a/debug.c b/debug.c index 39e7fc4f..3b56eede 100644 --- a/debug.c +++ b/debug.c @@ -818,7 +818,7 @@ dbgoprint(obj_t *pObj, char *fmt, ...) lenWriteBuf = vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap); if(lenWriteBuf >= sizeof(pszWriteBuf)) { /* if our buffer was too small, we simply truncate. TODO: maybe something better? */ - lenWriteBuf--; + lenWriteBuf = sizeof(pszWriteBuf) - 1; } va_end(ap); /* @@ -892,7 +892,7 @@ dbgprintf(char *fmt, ...) lenWriteBuf = vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap); if(lenWriteBuf >= sizeof(pszWriteBuf)) { /* if our buffer was too small, we simply truncate. TODO: maybe something better? */ - lenWriteBuf--; + lenWriteBuf = sizeof(pszWriteBuf) - 1; } va_end(ap); /* -- cgit v1.2.3