From owner-svn-src-head@FreeBSD.ORG Tue Dec 21 17:24:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D59471065695; Tue, 21 Dec 2010 17:24:32 +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 C53548FC17; Tue, 21 Dec 2010 17:24:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBLHOW6f070972; Tue, 21 Dec 2010 17:24:32 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBLHOWUE070970; Tue, 21 Dec 2010 17:24:32 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201012211724.oBLHOWUE070970@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Tue, 21 Dec 2010 17:24:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216619 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Dec 2010 17:24:33 -0000 Author: ae Date: Tue Dec 21 17:24:32 2010 New Revision: 216619 URL: http://svn.freebsd.org/changeset/base/216619 Log: Check number of arguments before trying to read arg0. This prevents access to arg0 and dumping core when `gpart bootcode` called without arguments. Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Tue Dec 21 17:10:29 2010 (r216618) +++ head/sbin/geom/class/part/geom_part.c Tue Dec 21 17:24:32 2010 (r216619) @@ -1133,6 +1133,8 @@ gpart_bootcode(struct gctl_req *req, uns geom_deletetree(&mesh); errx(EXIT_FAILURE, "Class %s not found.", s); } + if (gctl_get_int(req, "nargs") != 1) + errx(EXIT_FAILURE, "Invalid number of arguments."); s = gctl_get_ascii(req, "arg0"); if (s == NULL) abort();