All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libblkid exfat.c: Limit maximum number of iterations in find_label
@ 2016-08-30 10:07 Rostislav Skudnov
  2016-08-30 10:45 ` Karel Zak
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rostislav Skudnov @ 2016-08-30 10:07 UTC (permalink / raw)
  To: util-linux

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-30 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30 10:07 [PATCH] libblkid exfat.c: Limit maximum number of iterations in find_label Rostislav Skudnov
2016-08-30 10:45 ` Karel Zak
     [not found] ` <5af8ca2ea7cc4a77b41171b457d32229@nebula-exfe-01.nebula.local>
2016-08-30 10:54   ` Rostislav
2016-08-30 11:52 ` Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.