Module: wine Branch: master Commit: 3b6b2107e2648b562c7266b17c66ab263c374c31 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3b6b2107e2648b562c7266b17c...
Author: Francois Gouget fgouget@codeweavers.com Date: Sat Nov 10 01:00:54 2012 +0100
shell32: Fix a buffer overflow in CommandLineToArgvW().
---
dlls/shell32/shell32_main.c | 11 ++++++++--- 1 files 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) {