nuttx:Change fs strncpy to strlcpy to avoid losing'\0'

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
This commit is contained in:
zhouliang3
2021-12-29 20:17:34 +08:00
committed by Xiang Xiao
parent 76b2f7199d
commit 1f53a058fa
20 changed files with 60 additions and 55 deletions
+1 -1
View File
@@ -1779,7 +1779,7 @@ static int proc_readdir(struct fs_dirent_s *dir)
/* Save the filename and file type */
dir->fd_dir.d_type = node->dtype;
strncpy(dir->fd_dir.d_name, node->name, NAME_MAX);
strlcpy(dir->fd_dir.d_name, node->name, sizeof(dir->fd_dir.d_name));
/* Set up the next directory entry offset. NOTE that we could use the
* standard f_pos instead of our own private index.