diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2002-09-02 19:40:32 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2002-09-02 19:40:32 +0000 |
commit | 548b6cb84148764e6bb439731ad5f461c47f5255 (patch) | |
tree | 9bbf91e35c20de6b8a3fe86eb4cbb87ab5511933 /sbin/pfctl | |
parent | c137f5a7c49a9e00980ebd71ec3962deca8cb792 (diff) |
Make sure the interface specified with route-to/dup-to/fastroute exists
and null-terminate the interface name. Found by Michael Wallis.
ok henning@
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/parse.y | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index e0140dda0f6..3aae9cc3cf8 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.142 2002/08/20 06:32:17 dhartmei Exp $ */ +/* $OpenBSD: parse.y,v 1.143 2002/09/02 19:40:31 dhartmei Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -435,8 +435,13 @@ pfrule : action dir logquick interface route af proto fromto if ($5.rt) { r.rt = $5.rt; if ($5.string) { - memcpy(r.rt_ifname, $5.string, - sizeof(r.rt_ifname)); + strlcpy(r.rt_ifname, $5.string, + IFNAMSIZ); + if (!ifa_exists(r.rt_ifname)) { + yyerror("unknown interface %s", + r.rt_ifname); + YYERROR; + } free($5.string); } if ($5.addr) { |