Module Name: src
Committed By: maxv
Date: Sun Dec 28 12:57:44 UTC 2014
Modified Files:
src/sys/fs/ntfs: ntfs_vfsops.c
Log Message:
Ensure bps != 0 to prevent a division by zero. Zero byte per sector makes
no sense.
To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 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.98 src/sys/fs/ntfs/ntfs_vfsops.c:1.99
--- src/sys/fs/ntfs/ntfs_vfsops.c:1.98 Sun Dec 28 12:13:22 2014
+++ src/sys/fs/ntfs/ntfs_vfsops.c Sun Dec 28 12:57:44 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ntfs_vfsops.c,v 1.98 2014/12/28 12:13:22 maxv Exp $ */
+/* $NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 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.98 2014/12/28 12:13:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ntfs_vfsops.c,v 1.99 2014/12/28 12:57:44 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -324,11 +324,17 @@ ntfs_mountfs(struct vnode *devvp, struct
brelse(bp, 0);
bp = NULL;
+ /* Sanity checks. XXX: More checks are probably needed. */
if (strncmp(ntmp->ntm_bootfile.bf_sysid, NTFS_BBID, NTFS_BBIDLEN)) {
error = EINVAL;
dprintf(("ntfs_mountfs: invalid boot block\n"));
goto out;
}
+ if (ntmp->ntm_bps == 0) {
+ error = EINVAL;
+ dprintf(("ntfs_mountfs: invalid bytes per sector\n"));
+ goto out;
+ }
{
int8_t cpr = ntmp->ntm_mftrecsz;