procfs:fix cmdline overflow

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2024-12-11 19:58:32 +08:00 committed by Xiang Xiao
parent a94264ea00
commit 5e4c14d8e8

View file

@ -687,9 +687,9 @@ static ssize_t proc_cmdline(FAR struct proc_file_s *procfile,
/* Show the task / thread argument list (skipping over the name) */ /* Show the task / thread argument list (skipping over the name) */
linesize = nxtask_argvstr(tcb, procfile->line, remaining); linesize = nxtask_argvstr(tcb, procfile->line, sizeof(procfile->line));
copysize = procfs_memcpy(procfile->line, linesize, buffer, copysize = procfs_memcpy(procfile->line, linesize, buffer,
remaining, &offset); sizeof(procfile->line), &offset);
totalsize += copysize; totalsize += copysize;
buffer += copysize; buffer += copysize;
remaining -= copysize; remaining -= copysize;