nuttx-apps/nshlib
Jukka Laitinen c3247ecc6c nshlib/nsh_fscmds.c: Allocate a PATH_MAX sized buffer for unlink_recursive
This fixes heap corruption when deleting a folder containing other folders
or files. The issue appeared at commit 131d50ae9d, which removed the
stack-based temporary buffer.

unlink_recursive requires that the path is provided in PATH_MAX sized
buffer. It concatenates sub-folder or file names to the same buffer.

nsh_getfullpath just allocates a buffer using strdup, so there is no room
for concatenating more data to it.

To keep the stack usage smaller, instead of reverting the breaking commit,
allocate the temporary buffer with lib_get_pathbuffer instead.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-11-26 10:27:47 -05:00
..
CMakeLists.txt nshlib/nsh_builtin.c : Add support to run builtin dirrectly as command 2025-09-11 20:00:20 +08:00
Kconfig nshlib/nsh_builtin.c : Add support to run builtin dirrectly as command 2025-09-11 20:00:20 +08:00
Make.defs nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
Makefile nshlib/nsh_builtin.c : Add support to run builtin dirrectly as command 2025-09-11 20:00:20 +08:00
nsh.h nshlib/dd: remove nsh dd cmd 2025-04-20 00:41:18 +08:00
nsh_alias.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_altconsole.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_builtin.c nshlib/builtin: check background task before restore the signal 2025-02-12 10:30:05 -03:00
nsh_codeccmd.c nshlib/md5: Support reading from standard input 2025-07-02 10:59:40 -03:00
nsh_command.c nshlib/nsh_builtin.c : Add support to run builtin dirrectly as command 2025-09-11 20:00:20 +08:00
nsh_console.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_console.h apps/nshlib: replace CONFIG_NSH_LINELEN to LINE_MAX 2025-01-14 19:31:54 +08:00
nsh_consolemain.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_dbgcmds.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_envcmds.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_fileapps.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_fscmds.c nshlib/nsh_fscmds.c: Allocate a PATH_MAX sized buffer for unlink_recursive 2025-11-26 10:27:47 -05:00
nsh_fsutils.c nshlib/nsh_fsutils.c: fix getpid_callback function read size 2025-03-27 09:25:21 +08:00
nsh_init.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_login.c apps/nshlib: replace CONFIG_NSH_LINELEN to LINE_MAX 2025-01-14 19:31:54 +08:00
nsh_mmcmds.c apps/nshlib: Reuse local variable for cmd_memdump 2025-01-17 23:27:43 +08:00
nsh_mntcmds.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_modcmds.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_netcmds.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_parse.c nshlib/nsh_parse: Fix "e" flag not take effect 2025-09-18 02:15:49 +08:00
nsh_passwdcmds.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_printf.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_proccmds.c nshlib/nsh_proccmds.c: fix description for TID and switch order 2025-11-07 10:32:42 +08:00
nsh_prompt.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_routecmds.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_script.c nsh/script: remove double close for output fd 2025-05-14 15:03:35 +08:00
nsh_session.c apps/nshlib: replace CONFIG_NSH_LINELEN to LINE_MAX 2025-01-14 19:31:54 +08:00
nsh_syscmds.c nshlib/nsh_syscmds: Fix resetcause and rpmsg_help typos 2025-09-17 10:07:24 +02:00
nsh_system.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_telnetd.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_telnetlogin.c apps/nshlib: replace CONFIG_NSH_LINELEN to LINE_MAX 2025-01-14 19:31:54 +08:00
nsh_test.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_timcmds.c nshlib: Replace the big temp buffer with lib_get_[path|temp]buffer 2025-01-20 22:39:35 +08:00
nsh_usbconsole.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_usbtrace.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_vars.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh_wait.c nshlib: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
rc.sysinit.template nsh/script: support rc.sysinit script 2022-04-21 12:54:24 +03:00
rcS.template nsh/script: support rc.sysinit script 2022-04-21 12:54:24 +03:00