This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new b02ca0e6dc6 fs/procfs: bound the cmdline argument copy by the user
buffer
b02ca0e6dc6 is described below
commit b02ca0e6dc6740e81adf0bffa40f63148e564ef8
Author: xuxingliang <[email protected]>
AuthorDate: Thu Nov 12 16:51:04 2026 +0800
fs/procfs: bound the cmdline argument copy by the user buffer
proc_cmdline() copies the argument list with procfs_memcpy() using
sizeof(procfile->line) as the destination size instead of the space
left in the user buffer. A read() shorter than the command line
overflows the caller's buffer, and the size_t "remaining" wraps so
read() returns more bytes than requested. Pass "remaining" instead.
Signed-off-by: xuxingliang <[email protected]>
Signed-off-by: jingfei <[email protected]>
---
fs/procfs/fs_procfsproc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c
index 2ca63c938c5..53cbfa1db1f 100644
--- a/fs/procfs/fs_procfsproc.c
+++ b/fs/procfs/fs_procfsproc.c
@@ -723,7 +723,7 @@ static ssize_t proc_cmdline(FAR struct proc_file_s
*procfile,
linesize = nxtask_argvstr(tcb, procfile->line, sizeof(procfile->line));
copysize = procfs_memcpy(procfile->line, linesize, buffer,
- sizeof(procfile->line), &offset);
+ remaining, &offset);
totalsize += copysize;
buffer += copysize;
remaining -= copysize;