fix shell msh_exec memory over-bound.

This commit is contained in:
geniusgogo 2021-05-22 19:50:49 +08:00
parent 19de22f485
commit 6c01083502
1 changed files with 1 additions and 1 deletions

View File

@ -374,7 +374,7 @@ int msh_exec(char *cmd, rt_size_t length)
int cmd_ret;
/* strim the beginning of command */
while (*cmd == ' ' || *cmd == '\t')
while ((length > 0) && (*cmd == ' ' || *cmd == '\t'))
{
cmd++;
length--;