Be more careful when doing calculation with request from userland.
MFC after: 2 weeks
This commit is contained in:
parent
60dfbe416a
commit
62fdd4ef88
@ -1956,7 +1956,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS)
|
||||
if (error != 0 || req->newptr == NULL)
|
||||
return (error);
|
||||
|
||||
if (req->newlen + sizeof(struct pargs) > ps_arg_cache_limit)
|
||||
if (req->newlen > ps_arg_cache_limit - sizeof(struct pargs))
|
||||
return (ENOMEM);
|
||||
newpa = pargs_alloc(req->newlen);
|
||||
error = SYSCTL_IN(req, newpa->ar_args, req->newlen);
|
||||
|
Loading…
Reference in New Issue
Block a user