Skip to content

Commit b04fdd8

Browse files
authored
Merge pull request #3679 from DavidLin1577/patch-11
[finsh]Fixed a bug may cause stackover flow
2 parents d3c2704 + 5bb38bb commit b04fdd8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/finsh/msh_file.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ int msh_exec_script(const char *cmd_line, int size)
101101
int length;
102102

103103
line_buf = (char *) rt_malloc(RT_CONSOLEBUF_SIZE);
104+
if (line_buf == RT_NULL)
105+
{
106+
close(fd);
107+
return -RT_ENOMEM;
108+
}
104109

105110
/* read line by line and then exec it */
106111
do

0 commit comments

Comments
 (0)