Date: Wed, 15 Aug 2018 20:23:17 +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: r337867 - head/usr.sbin/jail Message-ID: <201808152023.w7FKNH4u055319@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jamie Date: Wed Aug 15 20:23:17 2018 New Revision: 337867 URL: https://svnweb.freebsd.org/changeset/base/337867 Log: 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 Modified: head/usr.sbin/jail/jail.c Modified: head/usr.sbin/jail/jail.c ============================================================================== --- head/usr.sbin/jail/jail.c Wed Aug 15 20:23:08 2018 (r337866) +++ head/usr.sbin/jail/jail.c Wed Aug 15 20:23:17 2018 (r337867) @@ -803,8 +803,10 @@ rdtun_params(struct cfjail *j, int dofail) exit(1); } 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_value = NULL; + } rval = 0; if (jailparam_get(rtparams, nrt, 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 && *(int *)jp->jp_value) && !(rtjp->jp_valuelen == jp->jp_valuelen && - !memcmp(rtjp->jp_value, jp->jp_value, - jp->jp_valuelen))) { + !((jp->jp_ctltype & CTLTYPE) == + CTLTYPE_STRING ? strncmp(rtjp->jp_value, + jp->jp_value, jp->jp_valuelen) : + memcmp(rtjp->jp_value, jp->jp_value, + jp->jp_valuelen)))) { if (dofail) { jail_warnx(j, "%s cannot be " "changed after creation",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808152023.w7FKNH4u055319>