Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 2010 22:25:22 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r203408 - head/sys/geom/virstor
Message-ID:  <201002022225.o12MPMdH094466@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002022225.o12MPMdH094466>