diff options
author | 2003-05-19 18:31:13 +0000 | |
---|---|---|
committer | 2003-05-19 18:31:13 +0000 | |
commit | 1ea01baf91a31e0bafe076c79c794890a079857b (patch) | |
tree | f45c51d28dd603650ec9b687a9d1a38e3d93d6a1 | |
parent | obviously wrong netmask (diff) | |
download | wireguard-openbsd-1ea01baf91a31e0bafe076c79c794890a079857b.tar.xz wireguard-openbsd-1ea01baf91a31e0bafe076c79c794890a079857b.zip |
all host() receivers have to test for NULL
-rw-r--r-- | sbin/pfctl/parse.y | 24 |
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 |