Don't let clobber jailparam values when checking for modification of
init-only parameters. Compare string parameter values with strncmp, not memcmp. PR: 230487 Reported by: Jason Mader MFC after: 3 days
This commit is contained in:
parent
f9be038601
commit
92bceb9756
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337867
@ -803,8 +803,10 @@ rdtun_params(struct cfjail *j, int dofail)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
for (jp = j->jp; jp < j->jp + j->njp; jp++)
|
for (jp = j->jp; jp < j->jp + j->njp; jp++)
|
||||||
if (JP_RDTUN(jp) && strcmp(jp->jp_name, "jid"))
|
if (JP_RDTUN(jp) && strcmp(jp->jp_name, "jid")) {
|
||||||
*++rtjp = *jp;
|
*++rtjp = *jp;
|
||||||
|
rtjp->jp_value = NULL;
|
||||||
|
}
|
||||||
rval = 0;
|
rval = 0;
|
||||||
if (jailparam_get(rtparams, nrt,
|
if (jailparam_get(rtparams, nrt,
|
||||||
bool_param(j->intparams[IP_ALLOW_DYING]) ? JAIL_DYING : 0) > 0) {
|
bool_param(j->intparams[IP_ALLOW_DYING]) ? JAIL_DYING : 0) > 0) {
|
||||||
@ -815,8 +817,11 @@ rdtun_params(struct cfjail *j, int dofail)
|
|||||||
jp->jp_valuelen == 0 &&
|
jp->jp_valuelen == 0 &&
|
||||||
*(int *)jp->jp_value) &&
|
*(int *)jp->jp_value) &&
|
||||||
!(rtjp->jp_valuelen == jp->jp_valuelen &&
|
!(rtjp->jp_valuelen == jp->jp_valuelen &&
|
||||||
!memcmp(rtjp->jp_value, jp->jp_value,
|
!((jp->jp_ctltype & CTLTYPE) ==
|
||||||
jp->jp_valuelen))) {
|
CTLTYPE_STRING ? strncmp(rtjp->jp_value,
|
||||||
|
jp->jp_value, jp->jp_valuelen) :
|
||||||
|
memcmp(rtjp->jp_value, jp->jp_value,
|
||||||
|
jp->jp_valuelen)))) {
|
||||||
if (dofail) {
|
if (dofail) {
|
||||||
jail_warnx(j, "%s cannot be "
|
jail_warnx(j, "%s cannot be "
|
||||||
"changed after creation",
|
"changed after creation",
|
||||||
|
Loading…
Reference in New Issue
Block a user