From owner-svn-src-head@FreeBSD.ORG Tue Jun 9 22:09:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA9031065690; Tue, 9 Jun 2009 22:09:29 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C971A8FC1A; Tue, 9 Jun 2009 22:09:29 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n59M9TmK085429; Tue, 9 Jun 2009 22:09:29 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n59M9T5U085428; Tue, 9 Jun 2009 22:09:29 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906092209.n59M9T5U085428@svn.freebsd.org> From: Jamie Gritton Date: Tue, 9 Jun 2009 22:09:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193865 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2009 22:09:30 -0000 Author: jamie Date: Tue Jun 9 22:09:29 2009 New Revision: 193865 URL: http://svn.freebsd.org/changeset/base/193865 Log: Fix some overflow errors: a signed allocation and an insufficiant array size. Reported by: pho Tested by: pho Approved by: bz (mentor) Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Tue Jun 9 21:58:14 2009 (r193864) +++ head/sys/kern/kern_jail.c Tue Jun 9 22:09:29 2009 (r193865) @@ -165,7 +165,7 @@ static char *pr_allow_nonames[] = { static unsigned jail_default_allow = JAIL_DEFAULT_ALLOW; static int jail_default_enforce_statfs = 2; #if defined(INET) || defined(INET6) -static int jail_max_af_ips = 255; +static unsigned jail_max_af_ips = 255; #endif #ifdef INET @@ -273,11 +273,19 @@ jail(struct thread *td, struct jail_args int kern_jail(struct thread *td, struct jail *j) { - struct iovec optiov[24]; + struct iovec optiov[2 * (4 + + sizeof(pr_allow_names) / sizeof(pr_allow_names[0]) +#ifdef INET + + 1 +#endif +#ifdef INET6 + + 1 +#endif + )]; struct uio opt; char *u_path, *u_hostname, *u_name; #ifdef INET - int ip4s; + uint32_t ip4s; struct in_addr *u_ip4; #endif #ifdef INET6 @@ -3671,7 +3679,7 @@ SYSCTL_PROC(_security_jail, OID_AUTO, ja sysctl_jail_jailed, "I", "Process in jail?"); #if defined(INET) || defined(INET6) -SYSCTL_INT(_security_jail, OID_AUTO, jail_max_af_ips, CTLFLAG_RW, +SYSCTL_UINT(_security_jail, OID_AUTO, jail_max_af_ips, CTLFLAG_RW, &jail_max_af_ips, 0, "Number of IP addresses a jail may have at most per address family"); #endif