소스 검색

dfs/romfs: validate ioctl args for RT_FIOGETADDR

Aphlita 13 시간 전
부모
커밋
c1a43bc0de
2개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c
  2. 5 0
      components/dfs/dfs_v2/filesystems/romfs/dfs_romfs.c

+ 5 - 0
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;
         }

+ 5 - 0
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;
         }