Skip to content

Commit 0f5a786

Browse files
JianyuWang0623xiaoxiang781216
authored andcommitted
nshlib: Fix stack-buffer-overflow of nsh_redirect()
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: #2469 Signed-off-by: wangjianyu3 <[email protected]>
1 parent 2429b2e commit 0f5a786

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nshlib/nsh_console.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
* See struct serialsave_s in nsh_console.c
7272
*/
7373

74-
#define SAVE_SIZE (2 * sizeof(int))
74+
#define SAVE_SIZE (3 * sizeof(int))
7575

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

0 commit comments

Comments
 (0)