svn commit: r339464 - head/sbin/pfctl

Kristof Provost kp at FreeBSD.org
Sat Oct 20 18:11:47 UTC 2018


Author: kp
Date: Sat Oct 20 18:11:46 2018
New Revision: 339464
URL: https://svnweb.freebsd.org/changeset/base/339464

Log:
  pfctl: Dup strings
  
  When we set the ifname we have to copy the string, rather than just keep
  the pointer.
  
  PR:		231323
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D17507

Modified:
  head/sbin/pfctl/parse.y

Modified: head/sbin/pfctl/parse.y
==============================================================================
--- head/sbin/pfctl/parse.y	Sat Oct 20 18:08:43 2018	(r339463)
+++ head/sbin/pfctl/parse.y	Sat Oct 20 18:11:46 2018	(r339464)
@@ -4408,7 +4408,7 @@ route_host	: STRING			{
 			$$ = calloc(1, sizeof(struct node_host));
 			if ($$ == NULL)
 				err(1, "route_host: calloc");
-			$$->ifname = $1;
+			$$->ifname = strdup($1);
 			set_ipmask($$, 128);
 			$$->next = NULL;
 			$$->tail = $$;
@@ -4418,7 +4418,7 @@ route_host	: STRING			{
 
 			$$ = $3;
 			for (n = $3; n != NULL; n = n->next)
-				n->ifname = $2;
+				n->ifname = strdup($2);
 		}
 		;
 


More information about the svn-src-all mailing list