Andrew Nguyen : kernel32/tests: Avoid an input buffer overrun in the empty console write test.

Alexandre Julliard julliard at winehq.org
Mon Jan 3 10:58:04 CST 2011


Module: wine
Branch: master
Commit: ab8b2cfaa17e5c70d3a0d75a0258805996ef7dac
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ab8b2cfaa17e5c70d3a0d75a0258805996ef7dac

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Sun Jan  2 21:18:36 2011 -0600

kernel32/tests: Avoid an input buffer overrun in the empty console write test.

---

 dlls/kernel32/tests/console.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
index 2f8cf84..da446a1 100644
--- a/dlls/kernel32/tests/console.c
+++ b/dlls/kernel32/tests/console.c
@@ -171,9 +171,9 @@ static void testCursorInfo(HANDLE hCon)
 
 static void testEmptyWrite(HANDLE hCon)
 {
+    static const char	emptybuf[16];
     COORD		c;
     DWORD		len;
-    const char* 	mytest = "";
 
     c.X = c.Y = 0;
     ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left\n");
@@ -197,13 +197,13 @@ static void testEmptyWrite(HANDLE hCon)
     }
 
     len = -1;
-    ok(WriteConsole(hCon, mytest, 0, &len, NULL) != 0 && len == 0, "WriteConsole\n");
+    ok(WriteConsole(hCon, emptybuf, 0, &len, NULL) != 0 && len == 0, "WriteConsole\n");
     okCURSOR(hCon, c);
 
     /* WriteConsole does not halt on a null terminator and is happy to write
      * memory contents beyond the actual size of the buffer. */
     len = -1;
-    ok(WriteConsole(hCon, mytest, 16, &len, NULL) != 0 && len == 16, "WriteConsole\n");
+    ok(WriteConsole(hCon, emptybuf, 16, &len, NULL) != 0 && len == 16, "WriteConsole\n");
     c.X += 16;
     okCURSOR(hCon, c);
 }




More information about the wine-cvs mailing list