[PATCH] hfs.c: validate blocksize != 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Validate that blocksize != 0 as a blocksize == 0 can cause
a division-by-zero error.

Signed-off-by: Timo Warns <warns@xxxxxxxxxxxx>
---
diff -r -u a/shlibs/blkid/src/superblocks/hfs.c b/shlibs/blkid/src/superblocks/hfs.c
--- a/shlibs/blkid/src/superblocks/hfs.c	2011-04-19 13:09:52.000000000 +0200
+++ b/shlibs/blkid/src/superblocks/hfs.c	2011-05-06 10:56:17.000000000 +0200
@@ -225,6 +225,9 @@
 	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);
 
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux