Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 97 11:56:33 +0100
From:      iedowse@maths.tcd.ie
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/3528: fsck fails to detect some illegal block numbers
Message-ID:  <9705071156.aa11366@salmon.maths.tcd.ie>
Resent-Message-ID: <199705071110.EAA17012@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3528
>Category:       bin
>Synopsis:       fsck fails to detect some illegal block numbers
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May  7 04:10:01 PDT 1997
>Last-Modified:
>Originator:     Ian Dowse
>Organization:
>Release:        FreeBSD 2.2-STABLE i386
>Environment:

FreeBSD 2.2-STABLE i386

>Description:

fsck fails to detect some illegal block numbers due to an overflow in
chkrange(). A block number of -1 results in the error:

CANNOT SEEK: BLK -1

chkrange(blk,cnt) only checks that (blk+cnt) is within range. This is
not sufficient if the addition causes a wrap-around to the start of the
partition.


>How-To-Repeat:

Create an inode which has -1 as one of its block numbers, and run fsck
on the partition.

>Fix:

--- src/sbin/fsck/inode.c.old	Wed May  7 10:05:13 1997
+++ src/sbin/fsck/inode.c	Wed May  7 10:51:36 1997
@@ -234,7 +234,7 @@
 {
 	register int c;
 
-	if ((unsigned)(blk + cnt) > maxfsblock)
+	if ((unsigned)blk > maxfsblock || (unsigned)(blk + cnt) > maxfsblock)
 		return (1);
 	c = dtog(&sblock, blk);
 	if (blk < cgdmin(&sblock, c)) {
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9705071156.aa11366>