ソースを参照

dfs: check for null reference

Grissiom 10 年 前
コミット
9a75583349
1 ファイル変更3 行追加0 行削除
  1. 3 0
      components/dfs/src/dfs_file.c

+ 3 - 0
components/dfs/src/dfs_file.c

@@ -335,6 +335,9 @@ int dfs_file_lseek(struct dfs_fd *fd, rt_off_t offset)
 
 
     if (fd == RT_NULL)
     if (fd == RT_NULL)
         return -DFS_STATUS_EINVAL;
         return -DFS_STATUS_EINVAL;
+    fs = fd->fs;
+    if (fs == RT_NULL)
+        return -DFS_STATUS_EINVAL;
     if (fs->ops->lseek == RT_NULL)
     if (fs->ops->lseek == RT_NULL)
         return -DFS_STATUS_ENOSYS;
         return -DFS_STATUS_ENOSYS;