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:
parent
e51af88eed
commit
8054b4a371
@ -151,6 +151,11 @@ void read_fat(DOS_FS *fs)
|
|||||||
for (i = 2; i < fs->clusters+2; i++) {
|
for (i = 2; i < fs->clusters+2; i++) {
|
||||||
FAT_ENTRY curEntry;
|
FAT_ENTRY curEntry;
|
||||||
get_fat(&curEntry, fs->fat, i, fs);
|
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 &&
|
if (curEntry.value >= fs->clusters+2 &&
|
||||||
(curEntry.value < FAT_MIN_BAD(fs))) {
|
(curEntry.value < FAT_MIN_BAD(fs))) {
|
||||||
printf("Cluster %ld out of range (%ld > %ld). Setting to EOF.\n",
|
printf("Cluster %ld out of range (%ld > %ld). Setting to EOF.\n",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user