From 30ccc2bf64b29c4a749a1e34f6ed5b80f33aaca8 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Mon, 29 Dec 2008 08:14:07 +0100 Subject: [PATCH] Do not allow HFS partition with 0 allocation block. --- src/hfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hfs.c b/src/hfs.c index 30f30faf..845e2273 100644 --- a/src/hfs.c +++ b/src/hfs.c @@ -91,6 +91,9 @@ int test_HFS(disk_t *disk_car, const hfs_mdb_t *hfs_mdb,partition_t *partition,c /* Check for valid blocksize */ if(be32(hfs_mdb->drAlBlkSiz)%512!=0 || be32(hfs_mdb->drAlBlkSiz)==0) return 1; + /* Check for valid number of allocation blocks */ + if(be16(hfs_mdb->drNmAlBlks)==0) + return 1; /* Check for coherent block numbers */ if(be16(hfs_mdb->drFreeBks) > be16(hfs_mdb->drNmAlBlks)) return 1;