Date: Mon, 13 Nov 2017 07:47:43 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325755 - head/sys/kern Message-ID: <201711130747.vAD7lhHn098903@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Nov 13 07:47:43 2017 New Revision: 325755 URL: https://svnweb.freebsd.org/changeset/base/325755 Log: Be more careful when doing calculation with request from userland. MFC after: 2 weeks Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Mon Nov 13 03:41:50 2017 (r325754) +++ head/sys/kern/kern_proc.c Mon Nov 13 07:47:43 2017 (r325755) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711130747.vAD7lhHn098903>