4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-28 01:17:07 +08:00

fix dfsv2 romfs dfs_romfs_getdents buffer overflow.

This commit is contained in:
geniusgogo 2023-11-23 14:15:24 +08:00 committed by Meco Man
parent 26fbe01ada
commit 5a438c818a

View File

@ -352,7 +352,7 @@ static int dfs_romfs_getdents(struct dfs_file *file, struct dirent *dirp, uint32
d->d_namlen = rt_strlen(name); d->d_namlen = rt_strlen(name);
d->d_reclen = (rt_uint16_t)sizeof(struct dirent); d->d_reclen = (rt_uint16_t)sizeof(struct dirent);
rt_strncpy(d->d_name, name, rt_strlen(name) + 1); rt_strncpy(d->d_name, name, DFS_PATH_MAX);
/* move to next position */ /* move to next position */
++ file->fpos; ++ file->fpos;