svn commit: r216619 - head/sbin/geom/class/part
Andrey V. Elsukov
ae at FreeBSD.org
Tue Dec 21 17:24:33 UTC 2010
Author: ae
Date: Tue Dec 21 17:24:32 2010
New Revision: 216619
URL: http://svn.freebsd.org/changeset/base/216619
Log:
Check number of arguments before trying to read arg0. This prevents access
to arg0 and dumping core when `gpart bootcode` called without arguments.
Modified:
head/sbin/geom/class/part/geom_part.c
Modified: head/sbin/geom/class/part/geom_part.c
==============================================================================
--- head/sbin/geom/class/part/geom_part.c Tue Dec 21 17:10:29 2010 (r216618)
+++ head/sbin/geom/class/part/geom_part.c Tue Dec 21 17:24:32 2010 (r216619)
@@ -1133,6 +1133,8 @@ gpart_bootcode(struct gctl_req *req, uns
geom_deletetree(&mesh);
errx(EXIT_FAILURE, "Class %s not found.", s);
}
+ if (gctl_get_int(req, "nargs") != 1)
+ errx(EXIT_FAILURE, "Invalid number of arguments.");
s = gctl_get_ascii(req, "arg0");
if (s == NULL)
abort();
More information about the svn-src-head
mailing list