diff options
author | delphij <delphij@FreeBSD.org> | 2010-02-02 22:25:22 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2010-02-02 22:25:22 +0000 |
commit | 33ff87b33eec72c2b2a2489941b6b5b4c465506f (patch) | |
tree | 4f0267abb9251b0d33ece971f37e262158da9b69 /sys/geom | |
parent | 4d8ba24be37ee26fb93ed31e1c51cc165203fbe5 (diff) | |
download | FreeBSD-src-33ff87b33eec72c2b2a2489941b6b5b4c465506f.zip FreeBSD-src-33ff87b33eec72c2b2a2489941b6b5b4c465506f.tar.gz |
Prevent NULL deference by checking return value of
gctl_get_asciiparam.
MFC after: 2 weeks
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/virstor/g_virstor.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c index cd84b05..efdba4b 100644 --- a/sys/geom/virstor/g_virstor.c +++ b/sys/geom/virstor/g_virstor.c @@ -311,6 +311,11 @@ virstor_ctl_add(struct gctl_req *req, struct g_class *cp) 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, struct g_class *cp) 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); |