summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2005-03-24 02:40:26 +0000
committertedu <tedu@openbsd.org>2005-03-24 02:40:26 +0000
commit1510b4a10d768a8bc6900c9f8e404627fc02b364 (patch)
tree52cff903fa952b6673e6f74955aa11dd7edcdebd
parentfix memory leak in error paths. found with coverity prevent. (diff)
downloadwireguard-openbsd-1510b4a10d768a8bc6900c9f8e404627fc02b364.tar.xz
wireguard-openbsd-1510b4a10d768a8bc6900c9f8e404627fc02b364.zip
always good to check for invalid values. ok marius pedro
-rw-r--r--sys/kern/vfs_subr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 1068ce3d8e7..26cf7435dda 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.109 2005/01/10 11:58:34 pedro Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.110 2005/03/24 02:40:26 tedu Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -1571,7 +1571,8 @@ vfs_hang_addrlist(mp, nep, argp)
mp->mnt_flag |= MNT_DEFEXPORTED;
return (0);
}
- if (argp->ex_addrlen > MLEN)
+ if (argp->ex_addrlen > MLEN || argp->ex_masklen > MLEN ||
+ argp->ex_addrlen < 0 || argp->ex_masklen < 0)
return (EINVAL);
i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen;
np = (struct netcred *)malloc(i, M_NETADDR, M_WAITOK);