]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
execute: account for -o path option count
authorTycho Andersen <tycho@tycho.ws>
Wed, 9 May 2018 01:29:06 +0000 (01:29 +0000)
committerTycho Andersen <tycho@tycho.ws>
Wed, 9 May 2018 14:36:02 +0000 (14:36 +0000)
This always works fine... until your exec() fails and you try to go and
free it, you've overwritten the allocator's metadata (and potentially other
stuff) and it fails.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
src/lxc/execute.c

index 597233908661781560e68c69c372db84297c8741..b436b6a3f4e847792c53394d260775b924ae5808 100644 (file)
@@ -57,6 +57,9 @@ static int execute_start(struct lxc_handler *handler, void* data)
        if (lxc_log_has_valid_level())
                argc_add += 2;
 
+       if (current_config->logfd != -1 || lxc_log_fd != -1)
+               argc_add += 2;
+
        argv = malloc((argc + argc_add) * sizeof(*argv));
        if (!argv) {
                SYSERROR("Allocating init args failed");