Skip to content

Commit

Permalink
nshlib: Fix stack-buffer-overflow of nsh_redirect()
Browse files Browse the repository at this point in the history
Board/Config/Command
  sim:nsh
  cat < /etc/init.d/rc.sysinit

Problem
  The NSH hangs after exec the test command.
  `nsh_redirect()` needs to save three fd but array length is only two, stack buffer overflowed!

Related: apache#2469

Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 authored and xiaoxiang781216 committed Oct 13, 2024
1 parent 2429b2e commit 0f5a786
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nshlib/nsh_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
* See struct serialsave_s in nsh_console.c
*/

#define SAVE_SIZE (2 * sizeof(int))
#define SAVE_SIZE (3 * sizeof(int))

/* Are we using the NuttX console for I/O? Or some other character device? */

Expand Down

0 comments on commit 0f5a786

Please sign in to comment.