shell32: Fix a buffer overflow in CommandLineToArgvW().

This commit is contained in:
Francois Gouget 2012-11-10 01:00:54 +01:00 committed by Alexandre Julliard
parent 1262f07609
commit 3b6b2107e2
1 changed files with 8 additions and 3 deletions

View File

@ -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)
{