svn commit: r203949 - stable/8/sys/geom/virstor

Xin LI delphij at FreeBSD.org
Tue Feb 16 06:34:45 UTC 2010


Author: delphij
Date: Tue Feb 16 06:34:44 2010
New Revision: 203949
URL: http://svn.freebsd.org/changeset/base/203949

Log:
  MFC r203408:
  
  Prevent NULL deference by checking return value of
  gctl_get_asciiparam.

Modified:
  stable/8/sys/geom/virstor/g_virstor.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/geom/virstor/g_virstor.c
==============================================================================
--- stable/8/sys/geom/virstor/g_virstor.c	Tue Feb 16 05:14:51 2010	(r203948)
+++ stable/8/sys/geom/virstor/g_virstor.c	Tue Feb 16 06:34:44 2010	(r203949)
@@ -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);
 


More information about the svn-src-all mailing list