浏览代码

fix shell msh_exec memory over-bound.

geniusgogo 4 年之前
父节点
当前提交
6c01083502
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      components/finsh/msh.c

+ 1 - 1
components/finsh/msh.c

@@ -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--;