Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jul 2022 12:26:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 265001] loader: Comments in loader.conf ignored if they contain '"'
Message-ID:  <bug-265001-227-zdqRp7OUVn@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-265001-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-265001-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265001

--- Comment #1 from crahman@gmail.com ---
So the problem is that the lua parser in /boot/lua/config.lua is splitting =
the
line on the '=3D', sending the first match to the key and the second to the
value.

In the problem case, the value is:
   '"test b"               # This is "test_directive_b"'

Then the value gets matched against QVALEXPR =3D '"(.*)"'.

This cleans up the value by removing the first and last '"', but in this ca=
se
turns it into:

  test b"               # This is "test_directive_b

which then gets rejected in processEnvVar() with MSG_FAILSYN_QUOTE, since
values aren't allowed to contain '"'.

Changing QVALEXPR to '([-%w_]+)' fixes this problem.  Since the value is
explicitly prevented from containing quotes, it's not unreasonable to load =
it
from an expression that excludes them.  The only other place this is used i=
s in
the 'exec=3D"command"' expression, which also should not contain '"' in the
command value.

A patch is attached.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-265001-227-zdqRp7OUVn>