debugstr patch

Andreas Mohr a.mohr at mailto.de
Sun Jun 3 21:04:38 CDT 2001


Hello all,

ok, finally get rid of that very non-useful assert() stuff in
wine_db_vprintf().

Instead print the overflowing buffer content for very easy tracing
and assert() in a rather descriptive way.

Andreas Mohr
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: dlls/ntdll/debugtools.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/debugtools.c,v
retrieving revision 1.7
diff -u -r1.7 debugtools.c
--- dlls/ntdll/debugtools.c	2001/05/08 00:13:38	1.7
+++ dlls/ntdll/debugtools.c	2001/06/04 00:00:56
@@ -207,9 +207,16 @@
                          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)))
+    {
+	int debugstr_buffer_overflow = 1; /* for very descriptive assert() */
+        fprintf(stderr, "debugstr buffer overflow !! failed (overflowing) content: '%s'\n", info->output);
+	assert(debugstr_buffer_overflow == FALSE);
+    }
 
     p = strrchr( info->out_pos, '\n' );
     if (!p) info->out_pos += ret;


More information about the wine-patches mailing list