diff options
author | ae <ae@FreeBSD.org> | 2010-12-21 17:24:32 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2010-12-21 17:24:32 +0000 |
commit | 1d6bcd735e5e47b7d2457f772337c97f5705b63e (patch) | |
tree | 118b09f01f4f173b76593ef71380f6b11fd3d57b /sbin/geom | |
parent | 9d7bd11478a2bc79badff60c9d39e14e86c24d8f (diff) | |
download | FreeBSD-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.c | 2 |
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(); |