This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 105fd2aac nsh: fix a buffer overflow in help
105fd2aac is described below

commit 105fd2aac57e1239ee945bd8f8eaadd8a2381278
Author: yinshengkai <[email protected]>
AuthorDate: Thu Mar 9 12:46:53 2023 +0800

    nsh: fix a buffer overflow in help
    
    Signed-off-by: yinshengkai <[email protected]>
---
 nshlib/nsh_command.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index f0b5b77c8..82630d13c 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -675,7 +675,7 @@ static inline void help_cmdlist(FAR struct nsh_vtbl_s *vtbl)
         }
     }
 
-  colwidth += 2;
+  colwidth += HELP_TABSIZE;
 
   /* Determine the number of commands to put on one line */
 
@@ -890,7 +890,7 @@ static inline void help_builtins(FAR struct nsh_vtbl_s 
*vtbl)
       return;
     }
 
-  column_width += 2;
+  column_width += HELP_TABSIZE;
 
   /* Determine the number of commands to put on one line */
 
@@ -913,7 +913,7 @@ static inline void help_builtins(FAR struct nsh_vtbl_s 
*vtbl)
   nsh_write(vtbl, g_builtin_prompt, strlen(g_builtin_prompt));
   for (i = 0; i < num_builtin_rows; i++)
     {
-      offset = 4;
+      offset = HELP_TABSIZE;
       memset(line, ' ', offset);
 
       for (j = 0, k = i;

Reply via email to