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:
parent
b5fb93aefb
commit
8a80a853b7
@ -870,7 +870,8 @@ static int romfs_readdir(FAR struct inode *mountpt,
|
||||
|
||||
#ifdef CONFIG_FS_ROMFS_CACHE_NODE
|
||||
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++;
|
||||
#else
|
||||
/* Parse the directory entry */
|
||||
|
Loading…
Reference in New Issue
Block a user