- In sysctl_kern_file skip fdps with negative lastfiles. This can
happen if there are no files open. Accounting for these can eventually return a negative value for olenp causing sysctl to crash with a bad malloc. Reported by: Pawel Worach <pawel.worach@gmail.com>
This commit is contained in:
parent
9a62623a15
commit
a57decdf32
@ -2392,7 +2392,8 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
|
||||
if (fdp == NULL)
|
||||
continue;
|
||||
/* overestimates sparse tables. */
|
||||
n += fdp->fd_lastfile;
|
||||
if (fdp->fd_lastfile > 0)
|
||||
n += fdp->fd_lastfile;
|
||||
fddrop(fdp);
|
||||
}
|
||||
sx_sunlock(&allproc_lock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user