aboutsummaryrefslogtreecommitdiff
path: root/bpf_dump.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-04-25 19:04:40 -0700
committerGuy Harris <guy@alum.mit.edu>2018-04-25 19:04:40 -0700
commit9bac75ac0222df31e29ecacf2da423702b3e5c3d (patch)
tree5e5821c2af3f1ccd3ce07f41186ba95ab5bef17d /bpf_dump.c
parent711c82a52e7494be0b52148d2ad3eb8c51d9abdc (diff)
Do bounds checking on references to the bids array.
Addresses GitHub issue #484.
Diffstat (limited to 'bpf_dump.c')
-rw-r--r--bpf_dump.c5
1 files changed, 3 insertions, 2 deletions
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 <pcap.h>
#include <stdio.h>
+#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(" -- ");