summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lin <[email protected]>2020-06-12 08:49:46 +0800
committerGitHub <[email protected]>2020-06-12 08:49:46 +0800
commit7129694f381a5bbf825f3ad613d072812f45f509 (patch)
tree48dd6c5783b8ebadf25c39b9a3c05cbe8d95e658
parentb2e30a7efe3c513686f540fa61b705ae406b8156 (diff)
[finsh]Fixed a bug may cause stackover flow
add code: if (line_buf == RT_NULL) return -RT_ENOMEM;
-rw-r--r--components/finsh/msh_file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c
index 10251b4cb5..38519ce7a9 100644
--- a/components/finsh/msh_file.c
+++ b/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