Author: jamie Date: Thu Aug 27 00:17:17 2020 New Revision: 364850 URL: https://svnweb.freebsd.org/changeset/base/364850
Log: Don't allow jail.conf variables to have the same names as jail parameters. It was already not allowed in many cases, but crashed instead of giving an error. PR: 248444 Modified: head/usr.sbin/jail/config.c Modified: head/usr.sbin/jail/config.c ============================================================================== --- head/usr.sbin/jail/config.c Wed Aug 26 23:41:46 2020 (r364849) +++ head/usr.sbin/jail/config.c Thu Aug 27 00:17:17 2020 (r364850) @@ -366,8 +366,13 @@ add_param(struct cfjail *j, const struct cfparam *p, e break; if (dp != NULL) { /* Found it - append or replace. */ + if ((flags ^ dp->flags) & PF_VAR) { + jail_warnx(j, "variable \"$%s\" cannot have the same " + "name as a parameter.", name); + return; + } if (dp->flags & PF_IMMUTABLE) { - jail_warnx(j, "cannot redefine variable \"%s\".", + jail_warnx(j, "cannot redefine parameter \"%s\".", dp->name); return; } @@ -394,6 +399,14 @@ add_param(struct cfjail *j, const struct cfparam *p, e for (ipnum = IP__NULL + 1; ipnum < IP_NPARAM; ipnum++) if (!(intparams[ipnum].flags & PF_CONV) && equalopts(name, intparams[ipnum].name)) { + if (flags & PF_VAR) { + jail_warnx(j, + "variable \"$%s\" " + "cannot have the same " + "name as a parameter.", + name); + return; + } j->intparams[ipnum] = np; np->flags |= intparams[ipnum].flags; break; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"