summaryrefslogtreecommitdiff
path: root/sbin/fsck_msdos
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2000-06-28 17:42:07 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2000-06-28 17:42:07 +0000
commitf3990931c3d488ff08eb2e2f690107026a952d2f (patch)
treedb7bda4c103bbcdba1e445d8a12895b91cea8639 /sbin/fsck_msdos
parentd0d44db7fb2c6945fd2cfe2c718795285d380224 (diff)
prevent endless looping on looping fat chains
Diffstat (limited to 'sbin/fsck_msdos')
-rw-r--r--sbin/fsck_msdos/fat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/fsck_msdos/fat.c b/sbin/fsck_msdos/fat.c
index 36b0c8d08c3..9ed3137ad52 100644
--- a/sbin/fsck_msdos/fat.c
+++ b/sbin/fsck_msdos/fat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fat.c,v 1.8 1999/09/06 12:39:58 espie Exp $ */
+/* $OpenBSD: fat.c,v 1.9 2000/06/28 17:42:06 mickey Exp $ */
/* $NetBSD: fat.c,v 1.8 1997/10/17 11:19:53 ws Exp $ */
/*
@@ -35,7 +35,7 @@
#ifndef lint
-static char rcsid[] = "$OpenBSD: fat.c,v 1.8 1999/09/06 12:39:58 espie Exp $";
+static char rcsid[] = "$OpenBSD: fat.c,v 1.9 2000/06/28 17:42:06 mickey Exp $";
#endif /* not lint */
#include <stdlib.h>
@@ -368,7 +368,8 @@ checkfat(boot, fat)
/* follow the chain and mark all clusters on the way */
for (len = 0, p = head;
- p >= CLUST_FIRST && p < boot->NumClusters;
+ p >= CLUST_FIRST && p < boot->NumClusters &&
+ fat[p].head != head;
p = fat[p].next) {
fat[p].head = head;
len++;