From a0989cf5d210f0d45f9019cec204806401267e7f Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Mon, 19 May 2003 18:31:14 +0000 Subject: all host() receivers have to test for NULL --- sbin/pfctl/parse.y | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'sbin/pfctl') 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 -- cgit v1.2.3