From 26af8221025a890e13e6e0cc47d7062e5762f9ab Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Tue, 17 Jul 2001 00:56:37 +0000 Subject: [PATCH] More descriptive error on buffer overflow. --- dlls/ntdll/debugtools.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index 6e85b894008..f72dbef69d3 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -209,9 +209,16 @@ int wine_dbg_vprintf( const char *format, va_list args ) format, args ); /* make sure we didn't exceed the buffer length - * the two asserts are due to glibc changes in vsnprintfs return value */ - assert( ret != -1 ); - assert( ret < sizeof(info->output) - (info->out_pos - info->output) ); + * the two checks are due to glibc changes in vsnprintfs return value + * the buffer size can be exceeded in case of a missing \n in + * debug output */ + if ((ret == -1) || (ret >= sizeof(info->output) - (info->out_pos - info->output))) + { + fprintf( stderr, "wine_dbg_vprintf: debugstr buffer overflow (contents: '%s')\n", + info->output); + info->out_pos = info->output; + abort(); + } p = strrchr( info->out_pos, '\n' ); if (!p) info->out_pos += ret;