From owner-svn-src-stable@FreeBSD.ORG Fri Mar 1 16:19:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 10A40219; Fri, 1 Mar 2013 16:19:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 02C6B7ED; Fri, 1 Mar 2013 16:19:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21GJ952002536; Fri, 1 Mar 2013 16:19:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21GJ9wn002534; Fri, 1 Mar 2013 16:19:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303011619.r21GJ9wn002534@svn.freebsd.org> From: John Baldwin Date: Fri, 1 Mar 2013 16:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247554 - stable/8/lib/libproc X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Mar 2013 16:19:10 -0000 Author: jhb Date: Fri Mar 1 16:19:09 2013 New Revision: 247554 URL: http://svnweb.freebsd.org/changeset/base/247554 Log: MFC 246035: - Compute the correct size to reallocate when doubling the size of the array of loaded objects to avoid a buffer overrun. - Use reallocf() to avoid leaking memory if the realloc() fails. PR: kern/175648 Modified: stable/8/lib/libproc/proc_rtld.c Directory Properties: stable/8/lib/libproc/ (props changed) Modified: stable/8/lib/libproc/proc_rtld.c ============================================================================== --- stable/8/lib/libproc/proc_rtld.c Fri Mar 1 16:18:40 2013 (r247553) +++ stable/8/lib/libproc/proc_rtld.c Fri Mar 1 16:19:09 2013 (r247554) @@ -44,7 +44,8 @@ map_iter(const rd_loadobj_t *lop, void * if (phdl->nobjs >= phdl->rdobjsz) { phdl->rdobjsz *= 2; - phdl->rdobjs = realloc(phdl->rdobjs, phdl->rdobjsz); + phdl->rdobjs = reallocf(phdl->rdobjs, sizeof(*phdl->rdobjs) * + phdl->rdobjsz); if (phdl->rdobjs == NULL) return (-1); }