浏览代码

[finsh]Fixed a bug may cause stackover flow

add code:
if (line_buf == RT_NULL) return -RT_ENOMEM;
David Lin 5 年之前
父节点
当前提交
7129694f38
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      components/finsh/msh_file.c

+ 1 - 0
components/finsh/msh_file.c

@@ -101,6 +101,7 @@ int msh_exec_script(const char *cmd_line, int size)
         int length;
 
         line_buf = (char *) rt_malloc(RT_CONSOLEBUF_SIZE);
+        if (line_buf == RT_NULL) return -RT_ENOMEM;
 
         /* read line by line and then exec it */
         do