[Bug 10618] dll/kernel32/process. c build_argv returns incorrect argv array for a given command line string

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Nov 30 20:14:36 CST 2007


http://bugs.winehq.org/show_bug.cgi?id=10618





--- Comment #3 from Darragh Bailey <felix at compsoc.nuigalway.ie>  2007-11-30 20:14:35 ---
Following code snippet causes argv to be created correctly for this case, but
its hardly code that should be committed. Need to sit down and actually work
out how it should determine what is an escaped quote and when it is just a
quote preceded by a backslash. 

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index d770fd7..1f19037 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -988,7 +993,7 @@ static char **build_argv( const WCHAR *cmdlineW, int
reserved )
         } else if (*s=='\\') {
             /* '\', count them */
             bcount++;
-        } else if ((*s=='"') && ((bcount & 1)==0)) {
+        } else if ((*s=='"') && ( ((bcount & 1)==0) || ((*(s-2)!=' ') &&
(*(s-2)!='\t')  && (*(s-2)!='\0')) )) {
             /* unescaped '"' */
             in_quotes=!in_quotes;
             bcount=0;
@@ -1026,7 +1032,7 @@ static char **build_argv( const WCHAR *cmdlineW, int
reserved )
             bcount++;
         } else if (*s=='"') {
             /* '"' */
-            if ((bcount & 1)==0) {
+            if ( ((bcount & 1)==0) || ((*(s-2)!=' ') && (*(s-2)!='\t')  &&
(*(s-2)!='\0')) ) {
                 /* Preceded by an even number of '\', this is half that
                  * number of '\', plus a '"' which we discard.
                  */


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list