From fe9a226158095c8d8eaea7a0cb593aa4a9cd3698 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 6 May 2011 13:00:07 +0200 Subject: [PATCH] libblkid: ignore hfsplus superblocks with blocksize < 512 Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/hfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shlibs/blkid/src/superblocks/hfs.c b/shlibs/blkid/src/superblocks/hfs.c index a03ee4851b..e043994e32 100644 --- a/shlibs/blkid/src/superblocks/hfs.c +++ b/shlibs/blkid/src/superblocks/hfs.c @@ -126,6 +126,8 @@ struct hfsplus_vol_header { struct hfsplus_fork start_file; } __attribute__((packed)); +#define HFSPLUS_SECTOR_SIZE 512 + static int hfs_set_uuid(blkid_probe pr, unsigned char const *hfs_info, size_t len) { static unsigned char const hash_init[16] = { @@ -225,8 +227,8 @@ static int probe_hfsplus(blkid_probe pr, const struct blkid_idmag *mag) hfs_set_uuid(pr, hfsplus->finder_info.id, sizeof(hfsplus->finder_info.id)); blocksize = be32_to_cpu(hfsplus->blocksize); - if (blocksize == 0) - return 0; + if (blocksize < HFSPLUS_SECTOR_SIZE) + return -1; memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); cat_block = be32_to_cpu(extents[0].start_block); -- 2.47.3