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 "".
This commit is contained in:
Dima Dorfman 2001-06-03 04:58:51 +00:00
parent 69f5c95465
commit b8edb44cc3

View File

@ -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;