[msh] solve data access bugs and fix shell.c strcat()
When using musl libc's strcat, strcat itself will cause system crash.
This commit is contained in:
parent
61c1041d47
commit
e0f2313c53
|
@ -112,7 +112,11 @@ const char *finsh_get_prompt(void)
|
||||||
getcwd(&finsh_prompt[rt_strlen(finsh_prompt)], RT_CONSOLEBUF_SIZE - rt_strlen(finsh_prompt));
|
getcwd(&finsh_prompt[rt_strlen(finsh_prompt)], RT_CONSOLEBUF_SIZE - rt_strlen(finsh_prompt));
|
||||||
#endif
|
#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;
|
return finsh_prompt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue