Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Oct 2018 18:11:46 +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: r339464 - head/sbin/pfctl
Message-ID:  <201810201811.w9KIBkgw031405@repo.freebsd.org>

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



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