summaryrefslogtreecommitdiffstats
path: root/src/hfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-12-29 08:14:07 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2008-12-29 08:14:07 +0100
commit30ccc2bf64b29c4a749a1e34f6ed5b80f33aaca8 (patch)
tree927ef366557f8148e19fd30e3a21e0b6ce511718 /src/hfs.c
parentbb4d75d006077c6c74e2f177037d633612d9853e (diff)
Do not allow HFS partition with 0 allocation block.
Diffstat (limited to 'src/hfs.c')
-rw-r--r--src/hfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/hfs.c b/src/hfs.c
index 30f30fa..845e227 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;