Quick fix for breakage of bounds checking in rev.1.12. Only one

of the additional checks in rev.1.12 was wrong.  The others are a
bit inconsistent and are probably unnecessarily pessimal.  Checking
for overflow of addition, if necessary at all, should be done in
bpf_validate().

PR:	12484
This commit is contained in:
Bruce Evans 1999-07-04 08:07:35 +00:00
parent 260c6dbfb9
commit edff69904f

View File

@ -37,7 +37,7 @@
*
* @(#)bpf_filter.c 8.1 (Berkeley) 6/10/93
*
* $Id: bpf_filter.c,v 1.12 1998/12/07 16:31:15 eivind Exp $
* $Id: bpf_filter.c,v 1.13 1999/04/11 02:52:31 eivind Exp $
*/
#include <sys/param.h>
@ -330,7 +330,7 @@ bpf_filter(pc, p, wirelen, buflen)
case BPF_LD|BPF_B|BPF_IND:
k = X + pc->k;
if (pc->k >= buflen || X >= buflen - k) {
if (pc->k >= buflen || X >= buflen - pc->k) {
#ifdef KERNEL
register struct mbuf *m;