diff options
author | 2006-11-26 00:59:32 +0000 | |
---|---|---|
committer | 2006-11-26 00:59:32 +0000 | |
commit | 2ba0f8d865c09022cb435950ecbf6eb6df56ea10 (patch) | |
tree | f4aba035d769661e70dce77b360e6ae64dddd391 | |
parent | - disable usbf stuff till the missing header is in; unbreak kernel compile. (diff) | |
download | wireguard-openbsd-2ba0f8d865c09022cb435950ecbf6eb6df56ea10.tar.xz wireguard-openbsd-2ba0f8d865c09022cb435950ecbf6eb6df56ea10.zip |
Fix malloc() panic in msdosfs_mountfs(), okay thib@ deraadt@
Found using fuzz generator written by lmh@info-pull.com
-rw-r--r-- | sys/msdosfs/msdosfs_vfsops.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index b08da5cd167..f164a4b5156 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vfsops.c,v 1.40 2006/08/22 19:30:48 sturm Exp $ */ +/* $OpenBSD: msdosfs_vfsops.c,v 1.41 2006/11/26 00:59:32 pedro Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */ /*- @@ -542,7 +542,11 @@ msdosfs_mountfs(devvp, mp, p, argp) pmp->pm_inusemap = malloc(((pmp->pm_maxcluster + N_INUSEBITS - 1) / N_INUSEBITS) * sizeof(*pmp->pm_inusemap), - M_MSDOSFSFAT, M_WAITOK); + M_MSDOSFSFAT, M_WAITOK | M_CANFAIL); + if (pmp->pm_inusemap == NULL) { + error = EINVAL; + goto error_exit; + } /* * fillinusemap() needs pm_devvp. |