summaryrefslogtreecommitdiffstats
path: root/src/xfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-04-27 11:23:29 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-04-27 11:23:29 +0200
commit9ed4ebfef47a1c9cdf72433802db9916cd750740 (patch)
tree7aef41e777228f7f4330eabd0ff80bab59e5b7a2 /src/xfs.c
parentbe0edffbb6be30f1bcfe0ccfe58121af25ae9571 (diff)
XFS: stricter check for superblock detection
Diffstat (limited to 'src/xfs.c')
-rw-r--r--src/xfs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/xfs.c b/src/xfs.c
index 7bb61e6..59e4f3f 100644
--- a/src/xfs.c
+++ b/src/xfs.c
@@ -61,7 +61,10 @@ int check_xfs(disk_t *disk_car,partition_t *partition,const int verbose)
static int test_xfs(const disk_t *disk_car, const struct xfs_sb *sb, partition_t *partition, const int verbose)
{
- if (sb->sb_magicnum!=be32(XFS_SB_MAGIC))
+ if(sb->sb_magicnum!=be32(XFS_SB_MAGIC) ||
+ be16(sb->sb_sectsize) != (1U << sb->sb_sectlog) ||
+ be32(sb->sb_blocksize) != (1U << sb->sb_blocklog) ||
+ be16(sb->sb_inodesize) != (1U << sb->sb_inodelog))
return 1;
switch(be16(sb->sb_versionnum) & XFS_SB_VERSION_NUMBITS)
{