summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-05-19 18:31:14 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-05-19 18:31:14 +0000
commita0989cf5d210f0d45f9019cec204806401267e7f (patch)
tree1f74105d67ac1fa6424051bee68e17eb84ceb755
parent651d2dd12a5d5152748e7aebe68ec366b5486378 (diff)
all host() receivers have to test for NULL
-rw-r--r--sbin/pfctl/parse.y24
1 files changed, 15 insertions, 9 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index c4393aaacc9..9d0fc2b353b 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.386 2003/05/19 18:18:34 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.387 2003/05/19 18:31:13 henning Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -1729,12 +1729,6 @@ host_list : xhost { $$ = $1; }
xhost : not host {
struct node_host *n;
- if ($2 == NULL) {
- /* error. "any" is handled elsewhere */
- yyerror("could not parse host specification");
- YYERROR;
- }
-
for (n = $2; n != NULL; n = n->next)
n->not = $1;
$$ = $2;
@@ -1749,13 +1743,25 @@ xhost : not host {
}
;
-host : STRING { $$ = host($1); }
+host : STRING {
+ if (($$ = host($1)) == NULL) {
+ /* error. "any" is handled elsewhere */
+ yyerror("could not parse host specification");
+ YYERROR;
+ }
+
+ }
| STRING '/' number {
char *buf;
if (asprintf(&buf, "%s/%u", $1, $3) == -1)
err(1, "host: asprintf");
- $$ = host(buf);
+ if (($$ = host(buf)) == NULL) {
+ /* error. "any" is handled elsewhere */
+ free(buf);
+ yyerror("could not parse host specification");
+ YYERROR;
+ }
free(buf);
}
| dynaddr