summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-06-24 21:00:04 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-06-24 21:00:04 +0000
commita893304d41b0cdc53f283327d802c224ff057abd (patch)
tree06438a26af1111316e4e8baa5bc61954e4a0e74d
parent278aefeb15ce742863e847118613838f06d0fd0c (diff)
Remove the 8 page limit for sysctl_proc_args after discussing with Theo.
Add trivial support for passing a NULL pointer for the argv buffer; currently just returns ARG_MAX for KERN_PROC_ARGV and KERN_PROC_ENV.
-rw-r--r--sys/kern/kern_sysctl.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 818bad2654c..f79110b8cdd 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.114 2004/06/20 03:04:15 art Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.115 2004/06/24 21:00:03 millert Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1378,6 +1378,14 @@ sysctl_proc_args(int *name, u_int namelen, void *oldp, size_t *oldlenp,
if ((vp = pfind(pid)) == NULL)
return (ESRCH);
+ if (oldp == NULL) {
+ if (op == KERN_PROC_NARGV || op == KERN_PROC_NENV)
+ *oldlenp = sizeof(int);
+ else
+ *oldlenp = ARG_MAX; /* XXX XXX XXX */
+ return (0);
+ }
+
if (P_ZOMBIE(vp) || (vp->p_flag & P_SYSTEM))
return (EINVAL);
@@ -1426,12 +1434,6 @@ sysctl_proc_args(int *name, u_int namelen, void *oldp, size_t *oldlenp,
limit = *oldlenp - 1;
*oldlenp = 0;
- if (limit > 8 * PAGE_SIZE) {
- /* Don't allow a denial of service. */
- error = E2BIG;
- goto out;
- }
-
rargv = oldp;
/*