Skip to content

Commit

Permalink
nsh: fix a buffer overflow in help
Browse files Browse the repository at this point in the history
Signed-off-by: yinshengkai <[email protected]>
  • Loading branch information
Gary-Hobson authored and xiaoxiang781216 committed Aug 9, 2023
1 parent 902a1d7 commit 105fd2a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nshlib/nsh_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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 */

Expand All @@ -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;
Expand Down

0 comments on commit 105fd2a

Please sign in to comment.