Skip to content

Commit

Permalink
execute: account for -o path option count
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tych0 committed May 9, 2018
1 parent b2efeb0 commit 9c40b2d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lxc/execute.c
Expand Up @@ -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");
Expand Down

0 comments on commit 9c40b2d

Please sign in to comment.