diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-04-25 19:04:40 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-04-25 19:04:40 -0700 |
commit | 9bac75ac0222df31e29ecacf2da423702b3e5c3d (patch) | |
tree | 5e5821c2af3f1ccd3ce07f41186ba95ab5bef17d /bpf_dump.c | |
parent | 711c82a52e7494be0b52148d2ad3eb8c51d9abdc (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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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(" -- "); |