diff options
Diffstat (limited to 'libblkid')
-rw-r--r-- | libblkid/src/superblocks/hfs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libblkid/src/superblocks/hfs.c b/libblkid/src/superblocks/hfs.c index 19f14ed0d..7b0117405 100644 --- a/libblkid/src/superblocks/hfs.c +++ b/libblkid/src/superblocks/hfs.c @@ -25,6 +25,8 @@ struct hfs_finder_info { uint8_t id[8]; } __attribute__((packed)); +#define HFS_SECTOR_SIZE 512 + struct hfs_mdb { uint8_t signature[2]; uint32_t cr_date; @@ -153,6 +155,7 @@ static int hfs_set_uuid(blkid_probe pr, unsigned char const *hfs_info, size_t le static int probe_hfs(blkid_probe pr, const struct blkid_idmag *mag) { struct hfs_mdb *hfs; + int size; hfs = blkid_probe_get_sb(pr, mag, struct hfs_mdb); if (!hfs) @@ -162,6 +165,12 @@ static int probe_hfs(blkid_probe pr, const struct blkid_idmag *mag) (memcmp(hfs->embed_sig, "HX", 2) == 0)) return 1; /* Not hfs, but an embedded HFS+ */ + size = be32_to_cpu(hfs->al_blk_size); + if (!size || (size & (HFS_SECTOR_SIZE - 1))) { + DBG(LOWPROBE, ul_debug("\tbad allocation size - ignore")); + return 1; + } + hfs_set_uuid(pr, hfs->finder_info.id, sizeof(hfs->finder_info.id)); blkid_probe_set_label(pr, hfs->label, hfs->label_len); |