Avoid modifying command line string during argument count phase
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in 33s
Builds / ExectOS (amd64, release) (push) Successful in 31s
Builds / ExectOS (i686, debug) (push) Successful in 33s
Builds / ExectOS (i686, release) (push) Successful in 31s

This commit is contained in:
2026-04-20 12:45:50 +02:00
parent d6c2dabcbb
commit 57bd3d505e

View File

@@ -229,14 +229,31 @@ Shell::ParseCommand(IN PWCHAR CommandLine,
/* Count the tokens to determine the size of the argument vector */ /* Count the tokens to determine the size of the argument vector */
TempLine = CommandLine; TempLine = CommandLine;
Token = RTL::WideString::TokenizeWideString(TempLine, L" ", &SavePtr); while(*TempLine != L'\0')
while(Token != NULLPTR)
{ {
/* Skip leading spaces */
while(*TempLine == L' ')
{
/* Move to the next character */
TempLine++;
}
/* Check if the end of the string was reached */
if(*TempLine == L'\0')
{
/* End of the string, break the loop */
break;
}
/* One more argument found */ /* One more argument found */
ArgumentCount++; ArgumentCount++;
/* Continue tokenizing */ /* Skip the characters of the token */
Token = RTL::WideString::TokenizeWideString(NULLPTR, L" ", &SavePtr); while(*TempLine != L'\0' && *TempLine != L' ')
{
/* Move to the next character */
TempLine++;
}
} }
/* Check if the command line was empty */ /* Check if the command line was empty */