summaryrefslogtreecommitdiffstats
path: root/sbin/geom
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2010-12-21 17:24:32 +0000
committerae <ae@FreeBSD.org>2010-12-21 17:24:32 +0000
commit1d6bcd735e5e47b7d2457f772337c97f5705b63e (patch)
tree118b09f01f4f173b76593ef71380f6b11fd3d57b /sbin/geom
parent9d7bd11478a2bc79badff60c9d39e14e86c24d8f (diff)
downloadFreeBSD-src-1d6bcd735e5e47b7d2457f772337c97f5705b63e.zip
FreeBSD-src-1d6bcd735e5e47b7d2457f772337c97f5705b63e.tar.gz
Check number of arguments before trying to read arg0. This prevents access
to arg0 and dumping core when `gpart bootcode` called without arguments.
Diffstat (limited to 'sbin/geom')
-rw-r--r--sbin/geom/class/part/geom_part.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c
index 482b029..2da09cc 100644
--- a/sbin/geom/class/part/geom_part.c
+++ b/sbin/geom/class/part/geom_part.c
@@ -1133,6 +1133,8 @@ gpart_bootcode(struct gctl_req *req, unsigned int fl)
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();
OpenPOWER on IntegriCloud