diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-06-28 17:42:07 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-06-28 17:42:07 +0000 |
commit | f3990931c3d488ff08eb2e2f690107026a952d2f (patch) | |
tree | db7bda4c103bbcdba1e445d8a12895b91cea8639 /sbin/fsck_msdos | |
parent | d0d44db7fb2c6945fd2cfe2c718795285d380224 (diff) |
prevent endless looping on looping fat chains
Diffstat (limited to 'sbin/fsck_msdos')
-rw-r--r-- | sbin/fsck_msdos/fat.c | 7 |
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++; |