Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net - bpf_validate_ext: fix memword validation in BPF_ST...
details: https://anonhg.NetBSD.org/src/rev/d54f93f3da96
branches: trunk
changeset: 796909:d54f93f3da96
user: rmind <rmind%NetBSD.org@localhost>
date: Tue Jun 24 22:27:40 2014 +0000
description:
- bpf_validate_ext: fix memword validation in BPF_ST/BPF_STX case.
- bpf_set_extmem: check the number of words against BPF_MAX_MEMWORDS.
diffstat:
sys/net/bpf_filter.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (39 lines):
diff -r 15a5e595959b -r d54f93f3da96 sys/net/bpf_filter.c
--- a/sys/net/bpf_filter.c Tue Jun 24 22:24:18 2014 +0000
+++ b/sys/net/bpf_filter.c Tue Jun 24 22:27:40 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf_filter.c,v 1.63 2014/06/24 22:19:36 rmind Exp $ */
+/* $NetBSD: bpf_filter.c,v 1.64 2014/06/24 22:27:40 rmind Exp $ */
/*-
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.63 2014/06/24 22:19:36 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.64 2014/06/24 22:27:40 rmind Exp $");
#if 0
#if !(defined(lint) || defined(KERNEL))
@@ -79,8 +79,9 @@
int
bpf_set_extmem(bpf_ctx_t *bc, size_t nwords, bpf_memword_init_t preinited)
{
- /* XXX check arguments */
-
+ if (nwords > BPF_MAX_MEMWORDS) {
+ return EINVAL;
+ }
bc->extwords = nwords;
bc->preinited = preinited;
return 0;
@@ -661,7 +662,7 @@
goto out;
#if defined(KERNEL) || defined(_KERNEL)
/* validate the memory word */
- invalid &= ~BPF_MEMWORD_INIT(1 << p->k);
+ invalid &= ~BPF_MEMWORD_INIT(p->k);
#endif
break;
case BPF_ALU:
Home |
Main Index |
Thread Index |
Old Index