From c53b717016a9d35adeee32dba099ddd8ba56ea1c Mon Sep 17 00:00:00 2001 From: Daniel Hartmeier Date: Mon, 12 Aug 2002 19:36:05 +0000 Subject: Catch null pointer deref (segfault), from wilfried@ --- sbin/pfctl/parse.y | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'sbin/pfctl/parse.y') diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 7fb83b39dd9..12ffe00c63d 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.139 2002/08/06 13:43:33 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.140 2002/08/12 19:36:04 dhartmei Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -627,11 +627,15 @@ ipspec : ANY { $$ = NULL; } host_list : xhost { $$ = $1; } | host_list comma xhost { - /* both $1 and $3 may be lists, so join them */ - $$ = $3; - while ($3->next) - $3 = $3->next; - $3->next = $1; + if ($3 == NULL) + $$ = $1; + else { + /* both $1 and $3 may be lists, so join them */ + $$ = $3; + while ($3->next) + $3 = $3->next; + $3->next = $1; + } } ; -- cgit v1.2.3