FreeBSD Bugzilla – Attachment 232681 Details for
Bug 262471
jail utility crashes when supplied -m and vnet parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Properly detect value-less parameters in rdtun_params
bug262471.diff (text/plain), 1.65 KB, created by
Jamie Gritton
on 2022-03-24 20:25:00 UTC
(
hide
)
Description:
Properly detect value-less parameters in rdtun_params
Filename:
MIME Type:
Creator:
Jamie Gritton
Created:
2022-03-24 20:25:00 UTC
Size:
1.65 KB
patch
obsolete
>diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c >index eb3b19f2cb82..63096146f176 100644 >--- a/usr.sbin/jail/jail.c >+++ b/usr.sbin/jail/jail.c >@@ -790,7 +790,9 @@ static int > rdtun_params(struct cfjail *j, int dofail) > { > struct jailparam *jp, *rtparams, *rtjp; >- int nrt, rval; >+ const void *jp_value; >+ size_t jp_valuelen; >+ int nrt, rval, bool_true; > > if (j->flags & JF_RDTUN) > return 0; >@@ -818,15 +820,25 @@ rdtun_params(struct cfjail *j, int dofail) > rtjp = rtparams + 1; > for (jp = j->jp; rtjp < rtparams + nrt; jp++) { > if (JP_RDTUN(jp) && strcmp(jp->jp_name, "jid")) { >- if (!((jp->jp_flags & (JP_BOOL | JP_NOBOOL)) && >- jp->jp_valuelen == 0 && >- *(int *)jp->jp_value) && >- !(rtjp->jp_valuelen == 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)))) { >+ jp_value = jp->jp_value; >+ jp_valuelen = jp->jp_valuelen; >+ if (jp_value == NULL && jp_valuelen > 0) { >+ if (jp->jp_flags & (JP_BOOL | >+ JP_NOBOOL | JP_JAILSYS)) { >+ bool_true = 1; >+ jp_value = &bool_true; >+ jp_valuelen = sizeof(bool_true); >+ } else if ((jp->jp_ctltype & CTLTYPE) == >+ CTLTYPE_STRING) >+ jp_value = ""; >+ else >+ jp_valuelen = 0; >+ } >+ if (rtjp->jp_valuelen != jp_valuelen || >+ (CTLTYPE_STRING ? strncmp(rtjp->jp_value, >+ jp_value, jp_valuelen) >+ : memcmp(rtjp->jp_value, jp_value, >+ jp_valuelen))) { > if (dofail) { > jail_warnx(j, "%s cannot be " > "changed after creation",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 262471
: 232681