mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
fs/romfs: fix string overflow when the length of rn_name exceeds NAME_MAX + 1
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
b5fb93aefb
commit
8a80a853b7
+2
-1
@@ -870,7 +870,8 @@ static int romfs_readdir(FAR struct inode *mountpt,
|
|||||||
|
|
||||||
#ifdef CONFIG_FS_ROMFS_CACHE_NODE
|
#ifdef CONFIG_FS_ROMFS_CACHE_NODE
|
||||||
next = (*dir->u.romfs.fr_currnode)->rn_next;
|
next = (*dir->u.romfs.fr_currnode)->rn_next;
|
||||||
strcpy(dir->fd_dir.d_name, (*dir->u.romfs.fr_currnode)->rn_name);
|
strlcpy(dir->fd_dir.d_name, (*dir->u.romfs.fr_currnode)->rn_name,
|
||||||
|
sizeof(dir->fd_dir.d_name));
|
||||||
dir->u.romfs.fr_currnode++;
|
dir->u.romfs.fr_currnode++;
|
||||||
#else
|
#else
|
||||||
/* Parse the directory entry */
|
/* Parse the directory entry */
|
||||||
|
|||||||
Reference in New Issue
Block a user