aboutsummaryrefslogtreecommitdiff
path: root/sbin/geom/core
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2007-05-17 15:34:51 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2007-05-17 15:34:51 +0000
commitcf805fab877078d13efc462e2c4da1c2ea8ec5c1 (patch)
tree42e38766e7a4fea4c149b346680ce7bc5ba7c306 /sbin/geom/core
parentc6b342f8209426553f424e79d23fe1f996b2baaf (diff)
downloadsrc-cf805fab877078d13efc462e2c4da1c2ea8ec5c1.tar.gz
src-cf805fab877078d13efc462e2c4da1c2ea8ec5c1.zip
Fix the construction of the gctl_req that got broken by my
previous commit and that introduced optional parameters. Existing classes (like geli(8)) use empty strings by default and expect the parameter to be passed to the kernel as such. Also, the default value of a string argument can be NULL. Fix both cases by making the optional parameter conditional upon gc_argname being set and making sure to test for NULL before dereferencing the pointer. Reported by: brueffer@
Notes
Notes: svn path=/head/; revision=169659
Diffstat (limited to 'sbin/geom/core')
-rw-r--r--sbin/geom/core/geom.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 7547f502b0b4..1b9ea6b208ae 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -330,7 +330,9 @@ parse_arguments(struct g_command *cmd, struct gctl_req *req, int *argc,
gctl_ro_param(req, opt->go_name,
sizeof(intmax_t), opt->go_val);
} else if (G_OPT_TYPE(opt) == G_TYPE_STRING) {
- if (*(char *)opt->go_val != '\0')
+ if (cmd->gc_argname == NULL ||
+ opt->go_val == NULL ||
+ *(char *)opt->go_val != '\0')
gctl_ro_param(req, opt->go_name,
-1, opt->go_val);
} else {