svn commit: r344584 - stable/11/sys/geom

Mark Johnston markj at FreeBSD.org
Tue Feb 26 15:06:46 UTC 2019


Author: markj
Date: Tue Feb 26 15:06:44 2019
New Revision: 344584
URL: https://svnweb.freebsd.org/changeset/base/344584

Log:
  MFC r344305, r344365:
  Impose a limit on the number of GEOM_CTL arguments.
  
  admbug:	854

Modified:
  stable/11/sys/geom/geom_ctl.c
  stable/11/sys/geom/geom_ctl.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/geom_ctl.c
==============================================================================
--- stable/11/sys/geom/geom_ctl.c	Tue Feb 26 15:03:59 2019	(r344583)
+++ stable/11/sys/geom/geom_ctl.c	Tue Feb 26 15:06:44 2019	(r344584)
@@ -137,6 +137,12 @@ gctl_copyin(struct gctl_req *req)
 	char *p;
 	u_int i;
 
+	if (req->narg > GEOM_CTL_ARG_MAX) {
+		gctl_error(req, "too many arguments");
+		req->arg = NULL;
+		return;
+	}
+
 	ap = geom_alloc_copyin(req, req->arg, req->narg * sizeof(*ap));
 	if (ap == NULL) {
 		gctl_error(req, "bad control request");

Modified: stable/11/sys/geom/geom_ctl.h
==============================================================================
--- stable/11/sys/geom/geom_ctl.h	Tue Feb 26 15:03:59 2019	(r344583)
+++ stable/11/sys/geom/geom_ctl.h	Tue Feb 26 15:06:44 2019	(r344584)
@@ -76,7 +76,8 @@ struct gctl_req {
 
 #define GEOM_CTL	_IOW('G', GCTL_VERSION, struct gctl_req)
 
-#define PATH_GEOM_CTL	"geom.ctl"
+#define GEOM_CTL_ARG_MAX 2048	/* maximum number of parameters */
 
+#define PATH_GEOM_CTL	"geom.ctl"
 
 #endif /* _GEOM_GEOM_CTL_H_ */


More information about the svn-src-all mailing list