Page MenuHomeFreeBSD

D32699.diff
No OneTemporary

D32699.diff

diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c
--- a/sbin/fsck_msdosfs/dir.c
+++ b/sbin/fsck_msdosfs/dir.c
@@ -400,8 +400,21 @@
if (dir->head == CLUST_FREE) {
physicalSize = 0;
} else {
- if (!fat_is_valid_cl(fat, dir->head))
- return FSERROR;
+ if (!fat_is_valid_cl(fat, dir->head) || !fat_is_cl_head(fat, dir->head)) {
+ pwarn("Directory entry %s of size %u referencing invalid cluster %u\n",
+ fullpath(dir), dir->size, dir->head);
+ if (ask(1, "Truncate")) {
+ p[28] = p[29] = p[30] = p[31] = 0;
+ p[26] = p[27] = 0;
+ if (boot->ClustMask == CLUST32_MASK)
+ p[20] = p[21] = 0;
+ dir->size = 0;
+ dir->head = CLUST_FREE;
+ return FSDIRMOD;
+ } else {
+ return FSERROR;
+ }
+ }
ret = checkchain(fat, dir->head, &chainsize);
/*
* Upon return, chainsize would hold the chain length

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 20, 9:30 PM (12 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15985437
Default Alt Text
D32699.diff (860 B)

Event Timeline