Author: delphij
Date: Mon Nov 27 03:47:12 2017
New Revision: 326242
URL: https://svnweb.freebsd.org/changeset/base/326242

Log:
  MFC r325755: Be more careful when doing calculation with request from
  userland.

Modified:
  stable/11/sys/kern/kern_proc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_proc.c
==============================================================================
--- stable/11/sys/kern/kern_proc.c      Mon Nov 27 02:44:36 2017        
(r326241)
+++ stable/11/sys/kern/kern_proc.c      Mon Nov 27 03:47:12 2017        
(r326242)
@@ -1933,7 +1933,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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to