[PATCH] libblkid exfat.c: Limit maximum number of iterations in find_label

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

 



Do not hang if there is a cluster chain loop in rootdir
---
 libblkid/src/superblocks/exfat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libblkid/src/superblocks/exfat.c b/libblkid/src/superblocks/exfat.c
index 01ed30b..e058423 100644
--- a/libblkid/src/superblocks/exfat.c
+++ b/libblkid/src/superblocks/exfat.c
@@ -86,8 +86,10 @@ static struct exfat_entry_label *find_label(blkid_probe pr,
 	uint32_t cluster = le32_to_cpu(sb->rootdir_cluster);
 	uint64_t offset = cluster_to_offset(sb, cluster);
 	uint8_t *entry;
+	const size_t max_iter = 10000;
+	size_t i = 0;
 
-	for (;;) {
+	for (; i<max_iter; i++) {
 		entry = (uint8_t *) blkid_probe_get_buffer(pr, offset,
 				EXFAT_ENTRY_SIZE);
 		if (!entry)
-- 
2.1.4

--
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