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
@@ -326,7 +326,7 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
finfo("Entry %d: \"%s\"\n", index, name);
dir->fd_dir.d_type = DTYPE_FILE;
strncpy(dir->fd_dir.d_name, name, NAME_MAX);
strlcpy(dir->fd_dir.d_name, name, sizeof(dir->fd_dir.d_name));
/* The application list is terminated by an entry with a NULL name.
* Therefore, there is at least one more entry in the list.