diff options
author | Jamie Gritton <jamie@FreeBSD.org> | 2009-06-09 22:09:29 +0000 |
---|---|---|
committer | Jamie Gritton <jamie@FreeBSD.org> | 2009-06-09 22:09:29 +0000 |
commit | e92e0574f93181f31e45cf6c9b55c40ab9e2601a (patch) | |
tree | b9574ce833ff2452987276be17afe237963428b3 /sys/kern/kern_jail.c | |
parent | 98fda6ac580b0a6773b4de518075ac50fa8252ff (diff) | |
download | src-e92e0574f93181f31e45cf6c9b55c40ab9e2601a.tar.gz src-e92e0574f93181f31e45cf6c9b55c40ab9e2601a.zip |
Fix some overflow errors: a signed allocation and an insufficiant
array size.
Reported by: pho
Tested by: pho
Approved by: bz (mentor)
Notes
Notes:
svn path=/head/; revision=193865
Diffstat (limited to 'sys/kern/kern_jail.c')
-rw-r--r-- | sys/kern/kern_jail.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 7a8a090404af..20a39c3fd584 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -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 *uap) 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, jailed, 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 |