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 <mail@daniel-baumann.ch>
This commit is contained in:
Steven J. Magnani 2009-10-04 08:37:19 +02:00 committed by Daniel Baumann
parent e51af88eed
commit 8054b4a371

View File

@ -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",