git: 0011a183ccd1 - stable/14 - MFC: fsck_msdosfs: fix 32-bit overflow computing the LOST.DIR offset

From: Xin LI <delphij_at_FreeBSD.org>
Date: Thu, 10 Sep 2026 02:32:12 UTC
The branch stable/14 has been updated by delphij:

URL: https://cgit.FreeBSD.org/src/commit/?id=0011a183ccd16fa315e4cf4c1f9650f81c6c9740

commit 0011a183ccd16fa315e4cf4c1f9650f81c6c9740
Author:     CooperCao <caopeng89@foxmail.com>
AuthorDate: 2026-09-03 07:10:12 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2026-09-10 02:31:07 +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) {