summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2022-03-28 02:58:07 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2022-03-28 02:58:07 +0000
commit0b4936cc883cc79753b88bb3314a40f27d3b0af0 (patch)
tree2fdbdabc99608599b55333c09a9998a58b66c08b
parent8e92c82971a01cc20a40e2152fd4b6c5715ba39d (diff)
tweak the pflog ifname filter to include the terminating nul.
without this the code effectively just compares the start of the string, which means you can get a prefix match unexpectedly. including the nul in the comparison means it only works for whole interface names, as it was originally intended. reported by Aner Perez on misc@ ok deraadt@ (who also dug through the history behind this)
-rw-r--r--lib/libpcap/gencode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c
index d15f17403d5..572e48d1f7a 100644
--- a/lib/libpcap/gencode.c
+++ b/lib/libpcap/gencode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gencode.c,v 1.60 2022/02/13 20:02:30 otto Exp $ */
+/* $OpenBSD: gencode.c,v 1.61 2022/03/28 02:58:06 dlg Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
@@ -3230,7 +3230,7 @@ gen_pf_ifname(char *ifname)
len - 1);
/* NOTREACHED */
}
- b0 = gen_bcmp(off, strlen(ifname), ifname);
+ b0 = gen_bcmp(off, strlen(ifname) + 1, ifname);
return (b0);
}