From 3b6b2107e2648b562c7266b17c66ab263c374c31 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Sat, 10 Nov 2012 01:00:54 +0100 Subject: [PATCH] shell32: Fix a buffer overflow in CommandLineToArgvW(). --- 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 7648dbb46e2..1507d4aee27 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) { -- 2.11.4.GIT