summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2020-06-13 16:23:40 +0800
committerGitHub <[email protected]>2020-06-13 16:23:40 +0800
commitb04fdd89ed74bb462fb1232e917ee5793d163183 (patch)
treee98a47e05968221854e07d91e5eb3dd591899de5
parentd3c270412deeaa491ed05f6550375845a30f109f (diff)
parent5bb38bb4e8110ed0e1b688969814d2b8bb78478f (diff)
Merge pull request #3679 from DavidLin1577/patch-11
[finsh]Fixed a bug may cause stackover flow
-rw-r--r--components/finsh/msh_file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c
index 10251b4cb5..10025965f0 100644
--- a/components/finsh/msh_file.c
+++ b/components/finsh/msh_file.c
@@ -101,6 +101,11 @@ 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)
+ {
+ close(fd);
+ return -RT_ENOMEM;
+ }
/* read line by line and then exec it */
do