Alexandre Julliard : explorer: Fix parsing command line that contains spaces.
Alexandre Julliard
julliard at winehq.org
Sun Mar 18 09:02:32 CDT 2018
Module: wine
Branch: oldstable
Commit: b6c0b0aa9da6caaff6485746080f61b94c8c8825
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b6c0b0aa9da6caaff6485746080f61b94c8c8825
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Dec 12 09:33:32 2017 +0100
explorer: Fix parsing command line that contains spaces.
Reported by Alistair Leslie-Hughes.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit ff53db7e6396337692ed2966ef3bf49a4737e3a6)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
programs/explorer/explorer.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/programs/explorer/explorer.c b/programs/explorer/explorer.c
index 0116d53..76bbd03 100644
--- a/programs/explorer/explorer.c
+++ b/programs/explorer/explorer.c
@@ -620,7 +620,7 @@ static IShellFolder* get_starting_shell_folder(parameters_struct* params)
return folder;
}
-static int copy_path_string(LPWSTR target, LPWSTR source)
+static WCHAR *copy_path_string(WCHAR *target, WCHAR *source)
{
INT i = 0;
@@ -629,10 +629,9 @@ static int copy_path_string(LPWSTR target, LPWSTR source)
if (*source == '\"')
{
source ++;
- while (*source != '\"') target[i++] = *source++;
+ while (*source && *source != '\"') target[i++] = *source++;
target[i] = 0;
- source ++;
- i+=2;
+ if (*source) source++;
}
else
{
@@ -640,7 +639,7 @@ static int copy_path_string(LPWSTR target, LPWSTR source)
target[i] = 0;
}
PathRemoveBackslashW(target);
- return i;
+ return source;
}
@@ -703,12 +702,12 @@ static void parse_command_line(LPWSTR commandline,parameters_struct *parameters)
else if (strncmpW(p, arg_root, sizeof(arg_root)/sizeof(WCHAR))==0)
{
p += sizeof(arg_root)/sizeof(WCHAR);
- p+=copy_path_string(parameters->root,p);
+ p = copy_path_string(parameters->root,p);
}
else if (strncmpW(p, arg_select, sizeof(arg_select)/sizeof(WCHAR))==0)
{
p += sizeof(arg_select)/sizeof(WCHAR);
- p+=copy_path_string(parameters->selection,p);
+ p = copy_path_string(parameters->selection,p);
if (!parameters->root[0])
copy_path_root(parameters->root,
parameters->selection);
More information about the wine-cvs
mailing list