svn commit: r239621 - head/usr.sbin/jail

Jamie Gritton jamie at FreeBSD.org
Thu Aug 23 19:39:23 UTC 2012


Author: jamie
Date: Thu Aug 23 19:39:23 2012
New Revision: 239621
URL: http://svn.freebsd.org/changeset/base/239621

Log:
  Partially roll back r239601 - keep parameter strings both length-delimited
  and null-terminated at the same time, because they're later passed to
  libjail as null-terminated.  That means I also need to add a nul byte when
  comma-combining array parameters.
  
  MFC after:	6 days

Modified:
  head/usr.sbin/jail/config.c

Modified: head/usr.sbin/jail/config.c
==============================================================================
--- head/usr.sbin/jail/config.c	Thu Aug 23 19:32:57 2012	(r239620)
+++ head/usr.sbin/jail/config.c	Thu Aug 23 19:39:23 2012	(r239621)
@@ -597,6 +597,7 @@ check_intparams(struct cfjail *j)
 					    "ip4.addr: bad netmask \"%s\"", cs);
 					error = -1;	
 				}
+				*cs = '\0';
 				s->len = cs - s->s;
 			}
 		}
@@ -620,6 +621,7 @@ check_intparams(struct cfjail *j)
 					    cs);
 					error = -1;	
 				}
+				*cs = '\0';
 				s->len = cs - s->s;
 			}
 		}
@@ -713,11 +715,10 @@ import_params(struct cfjail *j)
 			cs = value;
 			TAILQ_FOREACH_SAFE(s, &p->val, tq, ts) {
 				memcpy(cs, s->s, s->len);
-				if (ts != NULL) {
-					cs += s->len + 1;
-					cs[-1] = ',';
-				}
+				cs += s->len + 1;
+				cs[-1] = ',';
 			}
+			value[vallen - 1] = '\0';
 		}
 		if (jailparam_import(jp, value) < 0) {
 			error = -1;


More information about the svn-src-all mailing list