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:
parent
69f5c95465
commit
b8edb44cc3
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user