diff --git a/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c b/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c index b84c0498eb2..f50f0c74d62 100644 --- a/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c @@ -44,6 +44,11 @@ int dfs_romfs_ioctl(struct dfs_file *file, int cmd, void *args) { case RT_FIOGETADDR: { + if (args == RT_NULL) + { + ret = -RT_EINVAL; + break; + } *(rt_ubase_t*)args = (rt_ubase_t)dirent->data; break; } diff --git a/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c b/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c index 6350ad75f53..772e2218ae8 100644 --- a/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c @@ -64,6 +64,11 @@ int dfs_romfs_ioctl(struct dfs_file *file, int cmd, void *args) { case RT_FIOGETADDR: { + if (args == RT_NULL) + { + ret = -RT_EINVAL; + break; + } *(rt_ubase_t*)args = (rt_ubase_t)dirent->data; break; }