Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line with spaces bug #186

Closed
BIOS999 opened this issue Nov 11, 2020 · 2 comments
Closed

Command line with spaces bug #186

BIOS999 opened this issue Nov 11, 2020 · 2 comments
Labels

Comments

@BIOS999
Copy link

BIOS999 commented Nov 11, 2020

Try to run chrlauncher with spaced and quoted argument:
chrlauncher.exe --profile-directory="Profile 5"

And chrome will get it as:
chrome.exe --profile-directory=Profile 5

Because CommandLineToArgvW unquotes arguments (main.cpp line 245)
But we don't quote again on arguments building (main.cpp line 291)

Let's add quotting with replacing line 291:
_r_str_cat (pbi->args, _countof (pbi->args), arga[i]);
TO

WCHAR arg[128] = {0};
arg[0] = UNICODE_NULL;
_r_str_copy (arg, _countof (arg), arga[i]);
_r_str_replace (arg, L"\"", L"\\\"");
_r_str_cat (pbi->args, _countof (pbi->args), L"\"");
_r_str_cat (pbi->args, _countof (pbi->args), arg);
_r_str_cat (pbi->args, _countof (pbi->args), L"\"");

Additionally, it is good to add check for space and quote-symbol present in processing argument.

P.S. Sorry for mistake, I am on way, so I can't to check a code

@azev
Copy link

azev commented Dec 20, 2020

Same issue here.

chrlauncher.exe --user-agent="Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36"

Will run: --user-agent=Mozilla/5.0 Which fails because will report only Mozilla/5.0 to websites because chrlauncher is not passing the whole string along with quotes.

@azev
Copy link

azev commented Jun 5, 2021

To fix this issue I suggest chrlauncher to transform backquotes into double quotes:

--user-agent=`Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36`

chome.exe --user-agent="Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36"

@henrypp henrypp closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants