shell32: Fix a buffer overflow in CommandLineToArgvW().

Francois Gouget fgouget at codeweavers.com
Fri Nov 9 18:00:54 CST 2012


---
 dlls/shell32/shell32_main.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 7648dbb..1507d4a 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -227,15 +227,20 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
         if (*s)
             s++;
     }
-    /* close the argument */
+    /* close the executable path */
     *d++=0;
     /* skip to the first argument and initialize it if any */
     while (*s==' ' || *s=='\t')
         s++;
-    if (*s)
-        argv[argc++]=d;
+    if (!*s)
+    {
+        /* There are no parameters so we are all done */
+        *numargs=argc;
+        return argv;
+    }
 
     /* Split and copy the remaining arguments */
+    argv[argc++]=d;
     qcount=bcount=0;
     while (*s)
     {
-- 
1.7.10.4



More information about the wine-patches mailing list