Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Dec 2010 17:24:32 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216619 - head/sbin/geom/class/part
Message-ID:  <201012211724.oBLHOWUE070970@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012211724.oBLHOWUE070970>