mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-16 01:43:17 +00:00
system/readline: Fix the stack overflow when application name is too long
shouldn't zero the memory after tmp_name Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I527001af08da0865c4054b7a5b6ccaf60f585c06
This commit is contained in:
parent
bef5dc32a7
commit
3edfb4a3ac
1 changed files with 2 additions and 2 deletions
|
|
@ -302,7 +302,7 @@ static void tab_completion(FAR struct rl_common_s *vtbl, char *buf,
|
|||
* matches.
|
||||
*/
|
||||
|
||||
if (name[j] != tmp_name[j])
|
||||
if (j < sizeof(tmp_name) && name[j] != tmp_name[j])
|
||||
{
|
||||
tmp_name[j] = '\0';
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ static void tab_completion(FAR struct rl_common_s *vtbl, char *buf,
|
|||
* matches.
|
||||
*/
|
||||
|
||||
if (name[j] != tmp_name[j])
|
||||
if (j < sizeof(tmp_name) && name[j] != tmp_name[j])
|
||||
{
|
||||
tmp_name[j] = '\0';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue