summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/finsh/shell.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index b21b314525..e698edd51f 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -112,7 +112,11 @@ const char *finsh_get_prompt(void)
getcwd(&finsh_prompt[rt_strlen(finsh_prompt)], RT_CONSOLEBUF_SIZE - rt_strlen(finsh_prompt));
#endif
- strcat(finsh_prompt, ">");
+ if (rt_strlen(finsh_prompt) + 2 < RT_CONSOLEBUF_SIZE)
+ {
+ finsh_prompt[rt_strlen(finsh_prompt)] = '>';
+ finsh_prompt[rt_strlen(finsh_prompt) + 1] = '\0';
+ }
return finsh_prompt;
}