From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 28 04:57:53 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F1B8106564A; Tue, 28 Jun 2011 04:57:53 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6ECE98FC13; Tue, 28 Jun 2011 04:57:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5S4vr33029003; Tue, 28 Jun 2011 04:57:53 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5S4vrDj029001; Tue, 28 Jun 2011 04:57:53 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201106280457.p5S4vrDj029001@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 28 Jun 2011 04:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223618 - stable/8/sbin/geom/class/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2011 04:57:53 -0000 Author: ae Date: Tue Jun 28 04:57:53 2011 New Revision: 223618 URL: http://svn.freebsd.org/changeset/base/223618 Log: MFC r223364: When user specifies the bootcode with size smaller than VTOC_BOOTSIZE, gpart_write_partcode_vtoc8 does access out of range of allocated memory. Check size of bootcode before writing it. Pointed out by: ru Modified: stable/8/sbin/geom/class/part/geom_part.c Directory Properties: stable/8/sbin/geom/class/part/ (props changed) Modified: stable/8/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/8/sbin/geom/class/part/geom_part.c Tue Jun 28 01:32:18 2011 (r223617) +++ stable/8/sbin/geom/class/part/geom_part.c Tue Jun 28 04:57:53 2011 (r223618) @@ -1187,8 +1187,11 @@ gpart_bootcode(struct gctl_req *req, uns if (idx == 0) errx(EXIT_FAILURE, "missing -i option"); gpart_write_partcode(gp, idx, partcode, partsize); - } else + } else { + if (partsize != VTOC_BOOTSIZE) + errx(EXIT_FAILURE, "invalid bootcode"); gpart_write_partcode_vtoc8(gp, idx, partcode); + } } else if (bootcode == NULL) errx(EXIT_FAILURE, "no -b nor -p");