Bulletproof the debugger.

Medland, Bill Bill.Medland at accpac.com
Fri Dec 21 15:52:12 CST 2001


 <<diff37.txt>> 
-------------- next part --------------
Bill Medland (medbi01 at accpac.com)
Don't ask me why but on my setup vsnprintf returned a value greater than
the size of the buffer (much bigger), resulting in the debugger tripping
a segment violation.
Considering the location of this code I see no problem with using belts and
braces; it isn't going to be executed much but when it is we want it to work
(despite braindead operating systems)

Index: debugger/winedbg.c
===================================================================
RCS file: /home/wine/wine/debugger/winedbg.c,v
retrieving revision 1.43
diff -u -r1.43 winedbg.c
--- debugger/winedbg.c	2001/11/23 23:10:08	1.43
+++ debugger/winedbg.c	2001/12/21 20:16:35
@@ -50,7 +50,7 @@
     len = vsnprintf(buf, sizeof(buf), format, valist);
     va_end(valist);
 
-    if (len <= -1) {
+    if (len <= -1 || len >= sizeof(buf)) {
 	len = sizeof(buf) - 1;
 	buf[len] = 0;
 	buf[len - 1] = buf[len - 2] = buf[len - 3] = '.';


More information about the wine-patches mailing list