浏览代码

msh: check path is non-null in msh_auto_complete_path

Grissiom 11 年之前
父节点
当前提交
23cc390474
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      components/finsh/msh.c

+ 3 - 0
components/finsh/msh.c

@@ -358,6 +358,9 @@ void msh_auto_complete_path(char *path)
     struct dirent *dirent = RT_NULL;
     char *full_path, *ptr, *index;
 
+    if (!path)
+        return;
+
     full_path = (char*)rt_malloc(256);
     if (full_path == RT_NULL) return; /* out of memory */