Andrew Nguyen : kernel32: Don' t validate the command line parameter of CreateProcessW.

Alexandre Julliard julliard at winehq.org
Mon May 18 08:13:19 CDT 2009


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

Author: Andrew Nguyen <arethusa26 at gmail.com>
Date:   Mon May 18 05:07:04 2009 -0500

kernel32: Don't validate the command line parameter of CreateProcessW.

---

 dlls/kernel32/process.c       |    6 ------
 dlls/kernel32/tests/process.c |   10 ++++++++++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index b10d08a..8f486e0 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1787,12 +1787,6 @@ static LPWSTR get_file_name( LPCWSTR appname, LPWSTR cmdline, LPWSTR buffer,
         return ret;
     }
 
-    if (!cmdline)
-    {
-        SetLastError( ERROR_INVALID_PARAMETER );
-        return NULL;
-    }
-
     /* first check for a quoted file name */
 
     if ((cmdline[0] == '"') && ((p = strchrW( cmdline + 1, '"' ))))
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 7cc5841..6aac615 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -925,6 +925,16 @@ static void test_CommandLine(void)
     okChildStringWA("Arguments", "CommandLineW", buffer2);
     release_memory();
     assert(DeleteFileA(resfile) != 0);
+
+    if (0) /* Test crashes on NT-based Windows. */
+    {
+        /* Test NULL application name and command line parameters. */
+        SetLastError(0xdeadbeef);
+        ret = CreateProcessA(NULL, NULL, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
+        ok(!ret, "CreateProcessA unexpectedly succeeded\n");
+        ok(GetLastError() == ERROR_INVALID_PARAMETER,
+           "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+    }
 }
 
 static void test_Directory(void)




More information about the wine-cvs mailing list