aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2025-05-25 18:11:58 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2025-05-27 00:42:03 +0000
commite36f069ecb478b9775b7ad717768d011251d479e (patch)
tree6199b4e95a55ac782954becac45fa52db7729520
parent6cbf8a04b1864d933506301cabe213a9c918d968 (diff)
fsck_ffs: change struct bufarea member b_index type to uint64_t
It needs to correctly participate in the inode numbers arithmetic. It is possible to have inode number that is negative if truncated to 32 bit, which causes OOB accesses in ginode() calculating inode location in the inode block: ip->i_dp = (union dinode *) &ip->i_bp->b_un.b_dinode2[inumber - ip->i_bp->b_index]; Tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50520
-rw-r--r--sbin/fsck_ffs/fsck.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h
index 32d1d93e05c8..aaf02850f29a 100644
--- a/sbin/fsck_ffs/fsck.h
+++ b/sbin/fsck_ffs/fsck.h
@@ -153,7 +153,7 @@ struct bufarea {
int b_flags; /* B_ flags below */
int b_type; /* BT_ type below */
int b_refcnt; /* ref count of users */
- int b_index; /* for BT_LEVEL, ptr index */
+ uint64_t b_index; /* for BT_LEVEL, ptr index */
/* for BT_INODES, first inum */
union {
char *b_buf; /* buffer space */