diff options
author | bde <bde@FreeBSD.org> | 1997-12-21 00:00:44 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-12-21 00:00:44 +0000 |
commit | efbb6fdc12278e0007bdd770add16a11cc3fcd4b (patch) | |
tree | 8ba9b966548edd2fe8af69b1f074bb6414f763c2 /sbin/fsck_ifs/inode.c | |
parent | efc02439ae6f658dc47ccfa660f09f8706c4f756 (diff) | |
download | FreeBSD-src-efbb6fdc12278e0007bdd770add16a11cc3fcd4b.zip FreeBSD-src-efbb6fdc12278e0007bdd770add16a11cc3fcd4b.tar.gz |
Fixed overflow in chkrange(). Some out of bounds block numbers,
e.g. -1, were not detected. Use a bulletproof check that doesn't
depend on special properties of the args or the limit.
PR: 3528
Diffstat (limited to 'sbin/fsck_ifs/inode.c')
-rw-r--r-- | sbin/fsck_ifs/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/fsck_ifs/inode.c b/sbin/fsck_ifs/inode.c index c16571c..429dd3b 100644 --- a/sbin/fsck_ifs/inode.c +++ b/sbin/fsck_ifs/inode.c @@ -235,7 +235,7 @@ chkrange(blk, cnt) { register int c; - if ((unsigned)(blk + cnt) > maxfsblock) + if (blk < 0 || blk >= maxfsblock || cnt < 0 || cnt > maxfsblock - blk) return (1); c = dtog(&sblock, blk); if (blk < cgdmin(&sblock, c)) { |