Module Name:    src
Committed By:   maxv
Date:           Sat Feb 14 09:00:12 UTC 2015

Modified Files:
        src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
ffs_superblock_validate(): sanitize the number of frag blocks.


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 src/sys/ufs/ffs/ffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.312 src/sys/ufs/ffs/ffs_vfsops.c:1.313
--- src/sys/ufs/ffs/ffs_vfsops.c:1.312	Sat Feb 14 07:41:40 2015
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sat Feb 14 09:00:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.312 2015/02/14 07:41:40 maxv Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.313 2015/02/14 09:00:12 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.312 2015/02/14 07:41:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.313 2015/02/14 09:00:12 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -948,6 +948,10 @@ ffs_superblock_validate(struct fs *fs, u
 	if (fs_bsize < fs->fs_fsize)
 		return 0;
 
+	/* Check the number of frag blocks */
+	if ((fs_bsize / fs->fs_fsize) > MAXFRAG)
+		return 0;
+
 	return 1;
 }
 

Reply via email to