Merge bpf_filter.c r182380 and remove additional local checks

for BPF_STX and BPF_LDX|BPF_MEM instructions.
This commit is contained in:
Jung-uk Kim 2008-08-28 17:59:16 +00:00
parent 8cfdb2fb13
commit 855aaac7ac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182382

View File

@ -189,20 +189,12 @@ bpf_validate(const struct bpf_insn *f, int len)
* Check that memory operations use valid addresses.
*/
if ((BPF_CLASS(p->code) == BPF_ST ||
(BPF_CLASS(p->code) == BPF_LD &&
(p->code & 0xe0) == BPF_MEM)) &&
BPF_CLASS(p->code) == BPF_STX ||
((BPF_CLASS(p->code) == BPF_LD ||
BPF_CLASS(p->code) == BPF_LDX) &&
(p->code & 0xe0) == BPF_MEM)) &&
p->k >= BPF_MEMWORDS)
return (0);
#if BPF_VALIDATE > 1
/*
* XXX JK: BPF_STX and BPF_LDX|BPF_MEM must be checked.
*/
if ((BPF_CLASS(p->code) == BPF_STX ||
(BPF_CLASS(p->code) == BPF_LDX &&
(p->code & 0xe0) == BPF_MEM)) &&
p->k >= BPF_MEMWORDS)
return (0);
#endif
/*
* Check for constant division by 0.
*/