Source-Changes-HG archive

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

[src/trunk]: src/sbin/fsck_msdos Another infinite loop fix from OpenBSD from ...



details:   https://anonhg.NetBSD.org/src/rev/898af555c353
branches:  trunk
changeset: 797243:898af555c353
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jul 11 14:59:53 2014 +0000

description:
Another infinite loop fix from OpenBSD from Tobias Stoeckmann:

You can download a "proof of concept" from my website:
http://www.stoeckmann.org/openbsd/poc.iso.

Take FAT1 and it'll infinitely loop.  This fix will complete
your previous commit.

diffstat:

 sbin/fsck_msdos/fat.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r c9614e298fba -r 898af555c353 sbin/fsck_msdos/fat.c
--- a/sbin/fsck_msdos/fat.c     Fri Jul 11 08:50:08 2014 +0000
+++ b/sbin/fsck_msdos/fat.c     Fri Jul 11 14:59:53 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fat.c,v 1.28 2014/07/10 21:00:52 christos Exp $        */
+/*     $NetBSD: fat.c,v 1.29 2014/07/11 14:59:53 christos Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fat.c,v 1.28 2014/07/10 21:00:52 christos Exp $");
+__RCSID("$NetBSD: fat.c,v 1.29 2014/07/11 14:59:53 christos Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
@@ -392,7 +392,8 @@
 
                /* 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++;



Home | Main Index | Thread Index | Old Index