summaryrefslogtreecommitdiffstats
path: root/src/hfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-02-16 16:13:47 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-02-16 16:13:47 +0100
commitfaceca8b9a6f35385fd295e9ca9b259b5963291a (patch)
tree4dde54f25342ebe20cf8349dbb3900eb722a9eb0 /src/hfs.c
parent3badc433a4bee0df31ae1253b40d6cdf85c9296b (diff)
HFS and HFS+ blocksize must be a multiple of 512
Diffstat (limited to 'src/hfs.c')
-rw-r--r--src/hfs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hfs.c b/src/hfs.c
index 1d34b9c..46b7f04 100644
--- a/src/hfs.c
+++ b/src/hfs.c
@@ -88,8 +88,9 @@ int test_HFS(disk_t *disk_car, const hfs_mdb_t *hfs_mdb,partition_t *partition,c
/* Check for HFS signature */
if (hfs_mdb->drSigWord!=be16(HFS_SUPER_MAGIC))
return 1;
- /* Check for valid blocksize */
- if(be32(hfs_mdb->drAlBlkSiz)%512!=0 || be32(hfs_mdb->drAlBlkSiz)==0)
+ /* Blocksize must be a multiple of 512 */
+ if(be32(hfs_mdb->drAlBlkSiz)<512 ||
+ ((be32(hfs_mdb->drAlBlkSiz)-1) & be32(hfs_mdb->drAlBlkSiz))!=0)
return 1;
/* Check for valid number of allocation blocks */
if(be16(hfs_mdb->drNmAlBlks)==0)