]> 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)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Aug 2018 21:11:47 +0000 (23:11 +0200)
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 ba73b6b9ee5dc77af141582f9940374b219a4b8a..d5edf7a3374b2f47928e8172d06ba3291c8588fc 100644 (file)
@@ -64,6 +64,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)
                goto out1;