From b8edb44cc349331b8ac053aea7b35a5822294e5f Mon Sep 17 00:00:00 2001
From: Dima Dorfman
Date: Sun, 3 Jun 2001 04:58:51 +0000
Subject: [PATCH] When tring to find out if this is a request for a write in
kernel_sysctl and userland_sysctl, check for whether new is NULL, not whether
newlen is 0. This allows one to set a string sysctl to "".
---
sys/kern/kern_sysctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 99f2d695c56f..b3bf555c4665 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -862,7 +862,7 @@ kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
req.oldptr= old;
}
- if (newlen) {
+ if (new != NULL) {
req.newlen = newlen;
req.newptr = new;
}
@@ -1126,7 +1126,7 @@ userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *old
req.oldptr= old;
}
- if (newlen) {
+ if (new != NULL) {
if (!useracc(new, req.newlen, VM_PROT_READ))
return (EFAULT);
req.newlen = newlen;