mirror of
https://github.com/NevermindZZT/letter-shell.git
synced 2025-01-21 10:02:54 +08:00
限制shellParserParam函数解析参数后不大于设定值
This commit is contained in:
parent
8ebb339e99
commit
7f60ff5e54
@ -851,13 +851,11 @@ static void shellParserParam(Shell *shell)
|
||||
}
|
||||
if (record == 1)
|
||||
{
|
||||
//TODO 防止shell->parser.param[]越界
|
||||
if (shell->parser.paramCount < SHELL_PARAMETER_MAX_NUMBER)
|
||||
{
|
||||
shell->parser.param[shell->parser.paramCount] =
|
||||
shell->parser.param[shell->parser.paramCount++] =
|
||||
&(shell->parser.buffer[i]);
|
||||
}
|
||||
shell->parser.paramCount++;
|
||||
record = 0;
|
||||
}
|
||||
if (shell->parser.buffer[i] == '\\'
|
||||
@ -872,11 +870,6 @@ static void shellParserParam(Shell *shell)
|
||||
record = 1;
|
||||
}
|
||||
}
|
||||
//TODO 防止shell->parser.param[]越界 自动截断多余计数
|
||||
if (shell->parser.paramCount > SHELL_PARAMETER_MAX_NUMBER)
|
||||
{
|
||||
shell->parser.paramCount = SHELL_PARAMETER_MAX_NUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user