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
This commit is contained in:
Jamie Gritton 2012-08-23 19:39:23 +00:00
parent 671303c6d5
commit e9322de834
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239621

View File

@ -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;