summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2005-11-19 01:51:12 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2005-11-19 01:51:12 +0000
commit2ce5c95d13b01831f3ec854499928fd2b1b80943 (patch)
tree6cd4e3505384578249625b9070cfa1fd8ca2a5d9
parentd41d734f57eddb2b947dad4bcb9313bf1ec4160a (diff)
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
-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;
}
/*