Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/ntfs Prevent another division by zero in ntfs_loadntn...



details:   https://anonhg.NetBSD.org/src/rev/e9a9b22bf0dd
branches:  trunk
changeset: 335163:e9a9b22bf0dd
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Dec 28 13:11:52 2014 +0000

description:
Prevent another division by zero in ntfs_loadntnode() by ensuring
spc != 0.

diffstat:

 sys/fs/ntfs/ntfs_vfsops.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 05103b1dd9bc -r e9a9b22bf0dd sys/fs/ntfs/ntfs_vfsops.c
--- a/sys/fs/ntfs/ntfs_vfsops.c Sun Dec 28 12:57:44 2014 +0000
+++ b/sys/fs/ntfs/ntfs_vfsops.c Sun Dec 28 13:11:52 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 maxv Exp $    */
+/*     $NetBSD: ntfs_vfsops.c,v 1.100 2014/12/28 13:11:52 maxv Exp $   */
 
 /*-
  * Copyright (c) 1998, 1999 Semen Ustimenko
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.100 2014/12/28 13:11:52 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -335,6 +335,11 @@
                dprintf(("ntfs_mountfs: invalid bytes per sector\n"));
                goto out;
        }
+       if (ntmp->ntm_spc == 0) {
+               error = EINVAL;
+               dprintf(("ntfs_mountfs: invalid sectors per cluster\n"));
+               goto out;
+       }
 
        {
                int8_t cpr = ntmp->ntm_mftrecsz;



Home | Main Index | Thread Index | Old Index