[PATCH 2/2] msvcrt/tests: Add a printf test with NULL as format string

Detlef Riekenberg wine.dev at web.de
Wed Jul 6 15:03:04 CDT 2011


a better test would include an exception handler
---
 dlls/msvcrt/tests/printf.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c
index eb34ad8..c21d82e 100644
--- a/dlls/msvcrt/tests/printf.c
+++ b/dlls/msvcrt/tests/printf.c
@@ -575,6 +575,18 @@ static void test_sprintf( void )
     r = sprintf(buffer, format);
     ok(!strcmp(buffer,"%0"), "failed: \"%s\"\n", buffer);
     ok( r==2, "return count wrong\n");
+
+    if (0)
+    {
+        /* windows upto win2003 crash here, but there is an exception handler since vista */
+        memset(buffer, '#', sizeof(buffer) / 2);
+        buffer[sizeof(buffer) / 2] = 0;
+
+        r = sprintf(buffer, NULL);
+        ok( r==-1 , "return count wrong %d\n", r);
+        ok(strlen(buffer) == (sizeof(buffer) / 2), "buffer modified (%d): %s\n", strlen(buffer), buffer); 
+    }
+
 }
 
 static void test_swprintf( void )
-- 
1.7.5.4




More information about the wine-patches mailing list