From a2a90d6ee51a22feb72dc6c0adbb54b708a453b8 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Sat, 20 Oct 2018 18:11:46 +0000 Subject: [PATCH] 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 --- sbin/pfctl/parse.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 3b1f0bbea3dd..c542bf72f703 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -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); } ;