One of the general principles of the sysctl(3) API is that a user can

query the needed size for a sysctl result by passing in a NULL old
pointer and a valid oldsize.  The kern.proc.args sysctl handler broke
this assumption by not calling SYSCTL_OUT() if the old pointer was
NULL.

Approved by:	re (kib)
MFC after:	3 days
This commit is contained in:
jhb 2011-08-18 22:20:45 +00:00
parent 5384a68fd9
commit c902e65610

View File

@ -1391,7 +1391,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS)
pa = p->p_args;
pargs_hold(pa);
PROC_UNLOCK(p);
if (req->oldptr != NULL && pa != NULL)
if (pa != NULL)
error = SYSCTL_OUT(req, pa->ar_args, pa->ar_length);
pargs_drop(pa);
if (error != 0 || req->newptr == NULL)