Date: Tue, 16 Feb 2010 06:34:45 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r203949 - stable/8/sys/geom/virstor Message-ID: <201002160634.o1G6YjSP041020@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002160634.o1G6YjSP041020>