Date: Mon, 27 Nov 2017 03:49:51 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326243 - stable/10/sys/kern Message-ID: <201711270349.vAR3npp1010121@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Nov 27 03:49:51 2017 New Revision: 326243 URL: https://svnweb.freebsd.org/changeset/base/326243 Log: MFC r325755: Be more careful when doing calculation with request from userland. Modified: stable/10/sys/kern/kern_proc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_proc.c ============================================================================== --- stable/10/sys/kern/kern_proc.c Mon Nov 27 03:47:12 2017 (r326242) +++ stable/10/sys/kern/kern_proc.c Mon Nov 27 03:49:51 2017 (r326243) @@ -1858,7 +1858,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?201711270349.vAR3npp1010121>