From 13cdffd3026d568cb1865f62f785802f16bf5e0b Mon Sep 17 00:00:00 2001 From: chao an Date: Sun, 23 Apr 2023 14:08:00 +0800 Subject: [PATCH] fs/procfs: fix readdir loss last character nsh> ls proc/fs /proc/fs: ----> /proc/fs: block blocks moun mount usag usage Signed-off-by: chao an --- fs/procfs/fs_procfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index 8dc3305d76a12..28f3a12511624 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -885,7 +885,7 @@ static int procfs_readdir(FAR struct inode *mountpt, pathpattern[level1->subdirlen + 1]; level1->lastlen = strcspn(name, "/"); level1->lastread = name; - strlcpy(entry->d_name, name, level1->lastlen); + strlcpy(entry->d_name, name, level1->lastlen + 1); /* Some of the search entries contain '**' wildcards. When we * report the entry name, we must remove this wildcard search