summaryrefslogtreecommitdiffstats
path: root/src/jfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-07-30 10:52:21 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-07-30 10:52:21 +0200
commit436dee516cf4c2683b51932a6f714d52e273dfde (patch)
tree7a9241007911fe15b7de123764e737d0d9810fb3 /src/jfs.c
parentc711ef6587069238c8515f7123eb32ad824e932b (diff)
JFS filesystem: check blocksize
Diffstat (limited to 'src/jfs.c')
-rw-r--r--src/jfs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/jfs.c b/src/jfs.c
index ef1ecb6..df75d66 100644
--- a/src/jfs.c
+++ b/src/jfs.c
@@ -105,6 +105,10 @@ static int test_JFS(disk_t *disk_car, const struct jfs_superblock *sb, partition
{
if(memcmp(sb->s_magic,"JFS1",4)!=0)
return 1;
+ /* Blocksize must be a multiple of 512 */
+ if(le32(sb->s_bsize)<512 ||
+ ((le32(sb->s_bsize)-1) & le32(sb->s_bsize))!=0)
+ return 1;
if(dump_ind!=0)
{
log_info("\nJFS magic value at %u/%u/%u\n", offset2cylinder(disk_car,partition->part_offset),offset2head(disk_car,partition->part_offset),offset2sector(disk_car,partition->part_offset));