From owner-svn-src-stable@FreeBSD.ORG Fri Mar 1 16:18:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A9300F9F; Fri, 1 Mar 2013 16:18:41 +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 834DE7E4; Fri, 1 Mar 2013 16:18:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21GIfW8002434; Fri, 1 Mar 2013 16:18:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21GIfIT002433; Fri, 1 Mar 2013 16:18:41 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303011618.r21GIfIT002433@svn.freebsd.org> From: John Baldwin Date: Fri, 1 Mar 2013 16:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r247553 - stable/9/lib/libproc X-SVN-Group: stable-9 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:18:41 -0000 Author: jhb Date: Fri Mar 1 16:18:40 2013 New Revision: 247553 URL: http://svnweb.freebsd.org/changeset/base/247553 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/9/lib/libproc/proc_rtld.c Directory Properties: stable/9/lib/libproc/ (props changed) Modified: stable/9/lib/libproc/proc_rtld.c ============================================================================== --- stable/9/lib/libproc/proc_rtld.c Fri Mar 1 15:59:14 2013 (r247552) +++ stable/9/lib/libproc/proc_rtld.c Fri Mar 1 16:18:40 2013 (r247553) @@ -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); }