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:
John Baldwin 2011-08-18 22:20:45 +00:00
parent 672d7ddbcc
commit f55d3fbe84
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224986

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)