git: 8e0b31c791cf - stable/13 - Fix off-by-one error in fsck_ffs(8) chkrange() block-number check.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Fri, 19 May 2023 23:54:26 UTC
The branch stable/13 has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=8e0b31c791cf1da6d9fda3da9999e66a5e162230

commit 8e0b31c791cf1da6d9fda3da9999e66a5e162230
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2023-05-09 20:08:10 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2023-05-19 23:02:21 +0000

    Fix off-by-one error in fsck_ffs(8) chkrange() block-number check.
    
    PR:           271289
    
    (cherry picked from commit b3fe5d932264445cbf9a1c4eab01afb6179b499b)
---
 sbin/fsck_ffs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index 04891447254e..00a60157138c 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -381,8 +381,8 @@ chkrange(ufs2_daddr_t blk, int cnt)
 {
 	int c;
 
-	if (cnt <= 0 || blk <= 0 || blk > maxfsblock ||
-	    cnt - 1 > maxfsblock - blk) {
+	if (cnt <= 0 || blk <= 0 || blk >= maxfsblock ||
+	    cnt > maxfsblock - blk) {
 		if (debug)
 			printf("out of range: blk %ld, offset %i, size %d\n",
 			    (long)blk, (int)fragnum(&sblock, blk), cnt);