mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
Merge pull request #11858 from Pollux42/fix-parse-quote
Fix quote parsing
This commit is contained in:
@@ -244,8 +244,13 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
|
||||
if (*p != '"')
|
||||
WLog_ERR(TAG, "parsing error: uneven number of unescaped double quotes!");
|
||||
|
||||
if (p[0] && p[1])
|
||||
p += 1 + strcspn(&p[1], " \t\0");
|
||||
if (*p)
|
||||
{
|
||||
p++;
|
||||
|
||||
if (*p)
|
||||
p += strcspn(p, " \t\0");
|
||||
}
|
||||
|
||||
pArgs[numArgs++] = pOutput;
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ static const char* test_args_line_7 = "app.exe a\\\\\\\\\"b c\" d e f\\\\\\\\\"g
|
||||
|
||||
static const char* test_args_list_7[] = { "app.exe", "a\\\\b c", "d", "e", "f\\\\g h", "i", "j" };
|
||||
|
||||
static const char* test_args_line_8 = "app.exe arg1 \"arg2\"";
|
||||
|
||||
static const char* test_args_list_8[] = { "app.exe", "arg1", "arg2" };
|
||||
|
||||
static BOOL test_command_line_parsing_case(const char* line, const char** list, size_t expect)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
@@ -104,6 +108,9 @@ int TestThreadCommandLineToArgv(int argc, char* argv[])
|
||||
if (!test_command_line_parsing_case(test_args_line_7, test_args_list_7,
|
||||
ARRAYSIZE(test_args_list_7)))
|
||||
return -1;
|
||||
if (!test_command_line_parsing_case(test_args_line_8, test_args_list_8,
|
||||
ARRAYSIZE(test_args_list_8)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user