This is an automated email from the ASF dual-hosted git repository.
xiaoxiang 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 13cdffd302 fs/procfs: fix readdir loss last character
13cdffd302 is described below
commit 13cdffd3026d568cb1865f62f785802f16bf5e0b
Author: chao an <[email protected]>
AuthorDate: Sun Apr 23 14:08:00 2023 +0800
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 <[email protected]>
---
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 8dc3305d76..28f3a12511 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