tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: FFS: wrong superblock check ~> crash



On 20 Oct 2014, at 15:38, Maxime Villard <max%M00nBSD.net@localhost> wrote:

> Probably with the conviction I would find some bugs I opened ffs/ffs_vfsops.c
> and something immediately stroke me:

<snip>

> Index: ffs_vfsops.c
> ===================================================================
> RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
> retrieving revision 1.299
> diff -u -r1.299 ffs_vfsops.c
> --- ffs_vfsops.c	24 May 2014 16:34:04 -0000	1.299
> +++ ffs_vfsops.c	20 Oct 2014 13:01:46 -0000
> @@ -974,7 +974,7 @@
> 			continue;
> 
> 		/* Validate size of superblock */
> -		if (sbsize > MAXBSIZE || sbsize < sizeof(struct fs))
> +		if (sbsize > SBLOCKSIZE || sbsize < sizeof(struct fs))
> 			continue;
> 
> 		/* Check that we can handle the file system blocksize */
> 
> Tested on NetBSD-current: no longer crashes.
> 
> Ok/Comments?

Looks ok.

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig (Germany)



Home | Main Index | Thread Index | Old Index