Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ffs ffs_superblock_validate(): sanitize the number o...



details:   https://anonhg.NetBSD.org/src/rev/21d9216e3f74
branches:  trunk
changeset: 806279:21d9216e3f74
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Feb 14 09:00:12 2015 +0000

description:
ffs_superblock_validate(): sanitize the number of frag blocks.

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 95ae0a446021 -r 21d9216e3f74 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Sat Feb 14 08:46:02 2015 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Sat Feb 14 09:00:12 2015 +0000
@@ -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 @@
        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;
 }
 



Home | Main Index | Thread Index | Old Index