fs/readdir: Must reserve a byte for the NUL terminator

Change-Id: I1df0c278d289b90cc54512c0ee256a95549785ca
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong
2021-01-16 16:58:18 +08:00
committed by Xiang Xiao
parent f63e1e277f
commit 13100cf248
10 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -334,7 +334,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 + 1);
strncpy(dir->fd_dir.d_name, name, NAME_MAX);
/* The application list is terminated by an entry with a NULL name.
* Therefore, there is at least one more entry in the list.