summaryrefslogtreecommitdiffstats
path: root/lib/libpcap/optimize.c
diff options
context:
space:
mode:
authoraaron <aaron@openbsd.org>2005-11-19 01:51:11 +0000
committeraaron <aaron@openbsd.org>2005-11-19 01:51:11 +0000
commit3a418d8fbbedcc0a1ada8ba2ea686785e20442cb (patch)
tree0da75ffa5e9276a2ea2d70029961da85c04f2221 /lib/libpcap/optimize.c
parentoops (diff)
downloadwireguard-openbsd-3a418d8fbbedcc0a1ada8ba2ea686785e20442cb.tar.xz
wireguard-openbsd-3a418d8fbbedcc0a1ada8ba2ea686785e20442cb.zip
In count_stmts(), make sure to account for long jump instructions as well,
avoiding a memory error that could lead to a crash when a sufficiently complex bpf filter has been specified. otto@, millert@, djm@ ok Reference- http://www.tcpdump.org/lists/workers/2000/msg01364.html
Diffstat (limited to 'lib/libpcap/optimize.c')
-rw-r--r--lib/libpcap/optimize.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpcap/optimize.c b/lib/libpcap/optimize.c
index 36ea9da9360..48fc0dc6e94 100644
--- a/lib/libpcap/optimize.c
+++ b/lib/libpcap/optimize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: optimize.c,v 1.10 2004/01/27 06:58:03 tedu Exp $ */
+/* $OpenBSD: optimize.c,v 1.11 2005/11/19 01:51:11 aaron Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
@@ -1785,7 +1785,7 @@ count_stmts(p)
return 0;
Mark(p);
n = count_stmts(JT(p)) + count_stmts(JF(p));
- return slength(p->stmts) + n + 1;
+ return slength(p->stmts) + n + 1 + p->longjt + p->longjf;
}
/*