git: d3f871883f55 - stable/15 - MFC: fsck_msdosfs: fix 32-bit overflow computing the LOST.DIR offset
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Sep 2026 02:32:39 UTC
The branch stable/15 has been updated by delphij:
URL: https://cgit.FreeBSD.org/src/commit/?id=d3f871883f5562f0132f6b7dab9e59a772846032
commit d3f871883f5562f0132f6b7dab9e59a772846032
Author: CooperCao <caopeng89@foxmail.com>
AuthorDate: 2026-09-03 07:10:12 +0000
Commit: Xin LI <delphij@FreeBSD.org>
CommitDate: 2026-09-10 02:27:36 +0000
MFC: fsck_msdosfs: fix 32-bit overflow computing the LOST.DIR offset
(cherry picked from commit d3c5464fee7b178a39c189363e48806a11fd3da4)
---
sbin/fsck_msdosfs/dir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c
index 2d7e4bcdc38f..e24824261a9f 100644
--- a/sbin/fsck_msdosfs/dir.c
+++ b/sbin/fsck_msdosfs/dir.c
@@ -1129,8 +1129,8 @@ reconnect(struct fat_descriptor *fat, cl_t head, size_t length)
lfcl = (lostDir->head < boot->NumClusters) ? lostDir->head : 0;
return FSERROR;
}
- lfoff = (lfcl - CLUST_FIRST) * boot->ClusterSize
- + boot->FirstCluster * boot->bpbBytesPerSec;
+ lfoff = (off_t)(lfcl - CLUST_FIRST) * boot->ClusterSize +
+ (off_t)boot->FirstCluster * boot->bpbBytesPerSec;
if (lseek(dosfs, lfoff, SEEK_SET) != lfoff
|| (size_t)read(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) {