Bulletproof the debugger.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 <<diff37.txt>> 
Bill Medland (medbi01@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] = '.';

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux