summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2014-06-23 18:54:33 +0000
committertobias <tobias@openbsd.org>2014-06-23 18:54:33 +0000
commit701ac683e573b234e3effc156cb45bb2360d6e4c (patch)
treebbf5be426a28fecc459ca9a062436c505de2f63e
parentturn of IPv6 for new interfaces by default. this really just means there (diff)
downloadwireguard-openbsd-701ac683e573b234e3effc156cb45bb2360d6e4c.tar.xz
wireguard-openbsd-701ac683e573b234e3effc156cb45bb2360d6e4c.zip
Fix possible crash on invalid filesystems.
Merged from FreeBSD's revision 206098. ok beck@
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index a7d32669466..17dd9eb0a57 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vfsops.c,v 1.66 2014/06/18 17:24:46 tobias Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.67 2014/06/23 18:54:33 tobias Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */
/*-
@@ -385,7 +385,8 @@ msdosfs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p,
if ((SecPerClust == 0) || (SecPerClust & (SecPerClust - 1)) ||
(pmp->pm_BytesPerSec < DEV_BSIZE) ||
(pmp->pm_BytesPerSec & (pmp->pm_BytesPerSec - 1)) ||
- (pmp->pm_HugeSectors == 0) || (pmp->pm_FATsecs == 0)) {
+ (pmp->pm_HugeSectors == 0) || (pmp->pm_FATsecs == 0) ||
+ (SecPerClust * pmp->pm_BlkPerSec > MAXBSIZE / DEV_BSIZE)) {
error = EINVAL;
goto error_exit;
}