Module Name: src
Committed By: maxv
Date: Sun Dec 28 13:11:52 UTC 2014
Modified Files:
src/sys/fs/ntfs: ntfs_vfsops.c
Log Message:
Prevent another division by zero in ntfs_loadntnode() by ensuring
spc != 0.
To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/fs/ntfs/ntfs_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/fs/ntfs/ntfs_vfsops.c
diff -u src/sys/fs/ntfs/ntfs_vfsops.c:1.99 src/sys/fs/ntfs/ntfs_vfsops.c:1.100
--- src/sys/fs/ntfs/ntfs_vfsops.c:1.99 Sun Dec 28 12:57:44 2014
+++ src/sys/fs/ntfs/ntfs_vfsops.c Sun Dec 28 13:11:52 2014
@@ -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 @@ ntfs_mountfs(struct vnode *devvp, struct
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;