From owner-svn-src-head@FreeBSD.ORG Tue Feb 2 22:25:22 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 C5187106566B; Tue, 2 Feb 2010 22:25:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4D0F8FC1E; Tue, 2 Feb 2010 22:25:22 +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 o12MPMkR094468; Tue, 2 Feb 2010 22:25:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o12MPMdH094466; Tue, 2 Feb 2010 22:25:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201002022225.o12MPMdH094466@svn.freebsd.org> From: Xin LI Date: Tue, 2 Feb 2010 22:25:22 +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: r203408 - head/sys/geom/virstor 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, 02 Feb 2010 22:25:22 -0000 Author: delphij Date: Tue Feb 2 22:25:22 2010 New Revision: 203408 URL: http://svn.freebsd.org/changeset/base/203408 Log: Prevent NULL deference by checking return value of gctl_get_asciiparam. MFC after: 2 weeks Modified: head/sys/geom/virstor/g_virstor.c Modified: head/sys/geom/virstor/g_virstor.c ============================================================================== --- head/sys/geom/virstor/g_virstor.c Tue Feb 2 21:51:52 2010 (r203407) +++ head/sys/geom/virstor/g_virstor.c Tue Feb 2 22:25:22 2010 (r203408) @@ -311,6 +311,11 @@ virstor_ctl_add(struct gctl_req *req, st snprintf(aname, sizeof aname, "arg%d", i); prov_name = gctl_get_asciiparam(req, aname); + if (prov_name == NULL) { + gctl_error(req, "Error fetching argument '%s'", aname); + g_topology_unlock(); + return; + } if (strncmp(prov_name, _PATH_DEV, strlen(_PATH_DEV)) == 0) prov_name += strlen(_PATH_DEV); @@ -565,6 +570,10 @@ virstor_ctl_remove(struct gctl_req *req, sprintf(param, "arg%d", i); prov_name = gctl_get_asciiparam(req, param); + if (prov_name == NULL) { + gctl_error(req, "Error fetching argument '%s'", param); + return; + } if (strncmp(prov_name, _PATH_DEV, strlen(_PATH_DEV)) == 0) prov_name += strlen(_PATH_DEV);