Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2018 05:41:13 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339837 - head/sbin/pfctl
Message-ID:  <201810280541.w9S5fDVj011887@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810280541.w9S5fDVj011887>