Avoid segfault if name is invalid. Basically, only
check for CTL_USER if the sysctl fails with ENOENT. PR: 169056 Reviewed by: jhb
This commit is contained in:
parent
0dbe75e145
commit
4d8ed60cb4
@ -50,8 +50,11 @@ int
|
||||
sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
||||
const void *newp, size_t newlen)
|
||||
{
|
||||
if (name[0] != CTL_USER)
|
||||
return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
|
||||
int retval;
|
||||
|
||||
retval = __sysctl(name, namelen, oldp, oldlenp, newp, newlen);
|
||||
if (retval != -1 || errno != ENOENT || name[0] != CTL_USER)
|
||||
return (retval);
|
||||
|
||||
if (newp != NULL) {
|
||||
errno = EPERM;
|
||||
|
Loading…
Reference in New Issue
Block a user