]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix a read past the end of a buffer in fsck.
authormckusick <mckusick@FreeBSD.org>
Wed, 21 Feb 2018 20:32:23 +0000 (20:32 +0000)
committermckusick <mckusick@FreeBSD.org>
Wed, 21 Feb 2018 20:32:23 +0000 (20:32 +0000)
commitcceeb5ef0c726829bfa8d43a3c77fd288b205193
tree6d2679b9eadfffbd5e9718cf9cb6e0150dae9afa
parent742e4ff1b97a343acb440fd141825c44e66402d4
Fix a read past the end of a buffer in fsck.

To minimize the time spent scanning all of the directories in pass 2
(Check Pathnames), fsck uses a search order based on the location
of their first block. Zero length directories have no first block,
so the array being used to hold the block numbers of directory
inodes was of zero length. Thus a lookup was done past the end of
the array getting at best a random value and at worst a segment
fault.  For zero length directories, this change allocates a one
element block array and initializes it to zero. The effect is that
all zero length directories are handled first in pass 2.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D14163
sbin/fsck_ffs/inode.c