Merge pull request #3679 from DavidLin1577/patch-11

[finsh]Fixed a bug may cause stackover flow
This commit is contained in:
Bernard Xiong 2020-06-13 16:23:40 +08:00 committed by GitHub
commit b04fdd89ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -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