]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: validate hfs blocksize != 0
authorTimo Warns <Warns@Pre-Sense.DE>
Fri, 6 May 2011 09:04:24 +0000 (11:04 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 6 May 2011 10:37:36 +0000 (12:37 +0200)
Validate that blocksize != 0 as a blocksize == 0 can cause
a division-by-zero error.

Signed-off-by: Timo Warns <warns@pre-sense.de>
shlibs/blkid/src/superblocks/hfs.c

index aa9da0ce66989d73e18754893ea775396c595231..a03ee4851b1951ef8560286dbc58b158c033586a 100644 (file)
@@ -225,6 +225,9 @@ 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;
+
        memcpy(extents, hfsplus->cat_file.extents, sizeof(extents));
        cat_block = be32_to_cpu(extents[0].start_block);