svn commit: r339837 - head/sbin/pfctl
Kristof Provost
kp at FreeBSD.org
Sun Oct 28 05:41:14 UTC 2018
Author: kp
Date: Sun Oct 28 05:41:13 2018
New Revision: 339837
URL: https://svnweb.freebsd.org/changeset/base/339837
Log:
pfctl: Do not allow whitespace in macro names
i.e. "this is" = "a variable" is not valid. It was accepted by the
parser, but the variable could not be used afterwards.
Obtained from: OpenBSD
Modified:
head/sbin/pfctl/parse.y
Modified: head/sbin/pfctl/parse.y
==============================================================================
--- head/sbin/pfctl/parse.y Sun Oct 28 05:37:15 2018 (r339836)
+++ head/sbin/pfctl/parse.y Sun Oct 28 05:41:13 2018 (r339837)
@@ -758,8 +758,16 @@ numberstring : NUMBER {
;
varset : STRING '=' varstring {
+ char *s = $1;
if (pf->opts & PF_OPT_VERBOSE)
printf("%s = \"%s\"\n", $1, $3);
+ while (*s++) {
+ if (isspace((unsigned char)*s)) {
+ yyerror("macro name cannot contain "
+ "whitespace");
+ YYERROR;
+ }
+ }
if (symset($1, $3, 0) == -1)
err(1, "cannot store variable %s", $1);
free($1);
More information about the svn-src-all
mailing list