diff --git a/src/gen_bpf.c b/src/gen_bpf.c index 6961d09f..3787b7b0 100644 --- a/src/gen_bpf.c +++ b/src/gen_bpf.c @@ -364,6 +364,7 @@ static struct bpf_blk *_blk_resize(struct bpf_state *state, _blk_free(state, blk); return NULL; } + memset(&new[blk->blk_cnt], 0, (blk->blk_alloc - blk->blk_cnt) * sizeof(*new)); blk->blks = new; return blk; @@ -452,6 +453,7 @@ static int _bpf_append_blk(struct bpf_program *prg, const struct bpf_blk *blk) goto bpf_append_blk_failure; } prg->blks = i_new; + memset(&i_new[prg->blk_cnt - blk->blk_cnt], 0, blk->blk_cnt * sizeof(*(i_new))); /* transfer and translate the blocks to raw instructions */ for (iter = 0; iter < blk->blk_cnt; iter++) {