summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2006-01-03 20:26:03 +0000
committerjkim <jkim@FreeBSD.org>2006-01-03 20:26:03 +0000
commitae104d9814b199542431e6bc4bd83c1a9efdde8a (patch)
tree39c7a2b61e95daae0a092f19a5bc00725b0b46a8 /sys/i386
parentd339804fc16b1cfac17acb0d33520ec14d3b90da (diff)
downloadFreeBSD-src-ae104d9814b199542431e6bc4bd83c1a9efdde8a.zip
FreeBSD-src-ae104d9814b199542431e6bc4bd83c1a9efdde8a.tar.gz
- Explicitly validate an empty filter to match bpf_filter() comment[1].
- Do not use BPF JIT compiler for an empty filter. [1] Pointed out by: darrenr
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/bpf_jit_machdep.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/i386/i386/bpf_jit_machdep.c b/sys/i386/i386/bpf_jit_machdep.c
index 1465ce5..362569e 100644
--- a/sys/i386/i386/bpf_jit_machdep.c
+++ b/sys/i386/i386/bpf_jit_machdep.c
@@ -103,6 +103,10 @@ bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
*/
emit_func emitm;
+ /* Do not compile an empty filter. */
+ if (nins == 0)
+ return NULL;
+
/* Allocate the reference table for the jumps */
stream.refs = (u_int *)malloc((nins + 1) * sizeof(u_int),
M_BPFJIT, M_NOWAIT);
OpenPOWER on IntegriCloud