summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhartmei <dhartmei@openbsd.org>2002-09-02 19:40:31 +0000
committerdhartmei <dhartmei@openbsd.org>2002-09-02 19:40:31 +0000
commit1495e0efc88f96699cd9435bf5e276546cedb962 (patch)
treedecae517262251446f9db2fe4038ffd306ba854a
parentMake the cgfourteen work in 32bit when possible, also display the size of (diff)
downloadwireguard-openbsd-1495e0efc88f96699cd9435bf5e276546cedb962.tar.xz
wireguard-openbsd-1495e0efc88f96699cd9435bf5e276546cedb962.zip
Make sure the interface specified with route-to/dup-to/fastroute exists
and null-terminate the interface name. Found by Michael Wallis. ok henning@
-rw-r--r--sbin/pfctl/parse.y11
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) {