Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2012 19:39:23 +0000 (UTC)
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239621 - head/usr.sbin/jail
Message-ID:  <201208231939.q7NJdNgl083050@svn.freebsd.org>

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



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