From 9bac75ac0222df31e29ecacf2da423702b3e5c3d Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 25 Apr 2018 19:04:40 -0700 Subject: Do bounds checking on references to the bids array. Addresses GitHub issue #484. --- bpf_dump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bpf_dump.c') diff --git a/bpf_dump.c b/bpf_dump.c index b59d6073..a9c91169 100644 --- a/bpf_dump.c +++ b/bpf_dump.c @@ -26,6 +26,8 @@ #include #include +#include "optimize.h" + void bpf_dump(const struct bpf_program *p, int option) { @@ -50,8 +52,7 @@ bpf_dump(const struct bpf_program *p, int option) } for (i = 0; i < n; ++insn, ++i) { #ifdef BDEBUG - extern int bids[]; - if (bids[i] > 0) + if (i < NBIDS && bids[i] > 0) printf("[%02d]", bids[i] - 1); else printf(" -- "); -- cgit v1.2.3