From 8054b4a371a69eab1cb9c3c639dc38f5d3c03ddb Mon Sep 17 00:00:00 2001 From: "Steven J. Magnani" Date: Sun, 4 Oct 2009 08:37:19 +0200 Subject: [PATCH] Close hole that permitted clusters to link to (invalid) cluster 1. If an orphan chain that linked to cluster 1 was reclaimed to a file, deletion of the file would result in a filesystem panic. Signed-off-by: Daniel Baumann --- src/fat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fat.c b/src/fat.c index 063243e..0822bbe 100644 --- a/src/fat.c +++ b/src/fat.c @@ -151,6 +151,11 @@ void read_fat(DOS_FS *fs) for (i = 2; i < fs->clusters+2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); + if (curEntry.value == 1) { + printf("Cluster %ld out of range (1). Setting to EOF.\n", + i-2); + set_fat(fs, i, -1); + } if (curEntry.value >= fs->clusters+2 && (curEntry.value < FAT_MIN_BAD(fs))) { printf("Cluster %ld out of range (%ld > %ld). Setting to EOF.\n",