Unverified Commit 7e2624f3 by Serge Hallyn Committed by Christian Brauner

lxc_execute: properly figure out number of needed arguments

The lxc_log args have noghing to do with lxc.rootfs.path, and we need room for a NULL at end of arguments. How this bug was hidden for so long I don't know - I can only trigger it on certain systems under certain conditions, but it's definately wrong as is. Signed-off-by: 's avatarSerge Hallyn <shallyn@cisco.com>
parent 17cac30c
...@@ -119,14 +119,14 @@ static int execute_start(struct lxc_handler *handler, void* data) ...@@ -119,14 +119,14 @@ static int execute_start(struct lxc_handler *handler, void* data)
while (my_args->argv[argc++]); while (my_args->argv[argc++]);
argc_add = 4; /* lxc-init -n name -- [argc] NULL -> 5 */
argc_add = 5;
if (my_args->quiet) if (my_args->quiet)
argc_add++; argc_add++;
if (!handler->conf->rootfs.path) { if (!handler->conf->rootfs.path)
argc_add += 4; argc_add += 2;
if (lxc_log_has_valid_level()) if (lxc_log_has_valid_level())
argc_add += 2; argc_add += 2;
}
argv = malloc((argc + argc_add) * sizeof(*argv)); argv = malloc((argc + argc_add) * sizeof(*argv));
if (!argv) if (!argv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment