summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAphlita <[email protected]>2026-05-04 18:34:59 +0800
committerGitHub <[email protected]>2026-05-04 18:34:59 +0800
commitc1a43bc0deb17e6579d838dd7400618eb13d618c (patch)
treecc1d5304bb6b3259caf0a9d31f363bc8ec4909a3
parentb4436e9b2e93be155090cfcb8e8bafa39d436137 (diff)
dfs/romfs: validate ioctl args for RT_FIOGETADDR
-rw-r--r--components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c5
-rw-r--r--components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c b/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c
index b84c0498eb..f50f0c74d6 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 6350ad75f5..772e2218ae 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;
}