Author: markj
Date: Tue Feb 26 15:03:59 2019
New Revision: 344583
URL: https://svnweb.freebsd.org/changeset/base/344583

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

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

Modified: stable/12/sys/geom/geom_ctl.c
==============================================================================
--- stable/12/sys/geom/geom_ctl.c       Tue Feb 26 14:59:41 2019        
(r344582)
+++ stable/12/sys/geom/geom_ctl.c       Tue Feb 26 15:03:59 2019        
(r344583)
@@ -139,6 +139,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/12/sys/geom/geom_ctl.h
==============================================================================
--- stable/12/sys/geom/geom_ctl.h       Tue Feb 26 14:59:41 2019        
(r344582)
+++ stable/12/sys/geom/geom_ctl.h       Tue Feb 26 15:03:59 2019        
(r344583)
@@ -78,7 +78,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_ */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to