From: Christian Brauner Date: Sat, 30 Jan 2021 01:07:21 +0000 (+0100) Subject: cgroups: ensure all memory is zeroed X-Git-Tag: lxc-5.0.0~312^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=954d61c53f0c0c717129884e75f5281db6e42933;p=thirdparty%2Flxc.git cgroups: ensure all memory is zeroed Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgroup2_devices.c b/src/lxc/cgroups/cgroup2_devices.c index ef7d1ec9e..657640b8b 100644 --- a/src/lxc/cgroups/cgroup2_devices.c +++ b/src/lxc/cgroups/cgroup2_devices.c @@ -52,8 +52,9 @@ static int bpf_program_add_instructions(struct bpf_program *prog, new_insn = realloc(prog->instructions, sizeof(struct bpf_insn) * (count + prog->n_instructions)); if (!new_insn) return log_error_errno(-1, ENOMEM, "Failed to reallocate bpf cgroup program"); - prog->instructions = new_insn; + memset(prog->instructions + prog->n_instructions, 0, + sizeof(struct bpf_insn) * count); memcpy(prog->instructions + prog->n_instructions, instructions, sizeof(struct bpf_insn) * count); prog->n_instructions += count;