]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: ensure all memory is zeroed
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 30 Jan 2021 01:07:21 +0000 (02:07 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 30 Jan 2021 11:02:08 +0000 (12:02 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgroup2_devices.c

index ef7d1ec9e044fc73faf07074a7884baa384ae580..657640b8ba82cfc8fa68786a56300781c3b037e5 100644 (file)
@@ -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;