summaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-02-24 21:55:52 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-02-24 21:55:52 +0000
commitd4a76a185e0fef43b35700678bf7c494f56a3017 (patch)
tree670a974a887fddd1e0b0514326cd168fc9af3e04 /sbin/pfctl
parent0b32cd2605e62c687d0dfda2b036987f85386c8b (diff)
when a macro is redefined, don't bother with reusing the existing entry in
symset() but just prepend a new sym entry to symhead like we always did. as symget searches the list sequentially, the newest one is picked first. prevents an endless loop introduced when trying to reuse the existing entry by an invalid setting for the next pointer. fixes regress test pf57. found after conversation with Chris Linn, celinn at mtu dot edu ok dhartmei@ cedric@
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/parse.y12
1 files changed, 5 insertions, 7 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index da21ee56e4e..bca5d984e99 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.328 2003/02/21 10:54:57 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.329 2003/02/24 21:55:51 henning Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -3773,14 +3773,12 @@ symset(const char *nam, const char *val, int persist)
for (sym = symhead; sym && strcmp(nam, sym->nam); sym = sym->next)
; /* nothing */
- if (sym == NULL)
- sym = calloc(1, sizeof(*sym));
- else
- if (sym->persist == 1)
- return (0);
+ if (sym != NULL && sym->persist == 1)
+ return (0);
- if (sym == NULL)
+ if ((sym = calloc(1, sizeof(*sym))) == NULL)
return (-1);
+
sym->nam = strdup(nam);
if (sym->nam == NULL) {
free(sym);