1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Simplify jump instruction range checks.

MFC after:	1 month
This commit is contained in:
Jung-uk Kim 2008-08-29 01:47:45 +00:00
parent 3eb8b8bbeb
commit 28ae62aa8a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182425

View File

@ -552,14 +552,13 @@ bpf_validate(f, len)
* the code block. * the code block.
*/ */
if (BPF_CLASS(p->code) == BPF_JMP) { if (BPF_CLASS(p->code) == BPF_JMP) {
register int from = i + 1; register u_int offset;
if (BPF_OP(p->code) == BPF_JA) { if (BPF_OP(p->code) == BPF_JA)
if (from >= len || p->k >= len - from) offset = p->k;
return 0; else
} offset = p->jt > p->jf ? p->jt : p->jf;
else if (from >= len || p->jt >= len - from || if (offset >= (u_int)(len - i) - 1)
p->jf >= len - from)
return 0; return 0;
} }
/* /*