You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/09/04 06:58:52 UTC
[incubator-nuttx-apps] branch master updated: system/readline: Fix
the stack overflow when application name is too long
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 3edfb4a system/readline: Fix the stack overflow when application name is too long
3edfb4a is described below
commit 3edfb4a3acc0d01838d01367c2f5f7da9b1db57f
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Sep 3 22:40:10 2020 +0800
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 <xi...@xiaomi.com>
Change-Id: I527001af08da0865c4054b7a5b6ccaf60f585c06
---
system/readline/readline_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/system/readline/readline_common.c b/system/readline/readline_common.c
index 4fe7c6c..13750fe 100644
--- a/system/readline/readline_common.c
+++ b/system/readline/readline_common.c
@@ -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';
}