Skip to content

Commit e614100

Browse files
authored
Merge pull request #4720 from geniusgogo/fix_shell
fix shell msh_exec memory over-bound.
2 parents 19de22f + 6c01083 commit e614100

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/finsh/msh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ int msh_exec(char *cmd, rt_size_t length)
374374
int cmd_ret;
375375

376376
/* strim the beginning of command */
377-
while (*cmd == ' ' || *cmd == '\t')
377+
while ((length > 0) && (*cmd == ' ' || *cmd == '\t'))
378378
{
379379
cmd++;
380380
length--;

0 commit comments

Comments
 (0)