From 42a6217d42f9305f5b25a93188fed480ae4abc3d Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 13 Jul 2020 03:00:22 +0100 Subject: [PATCH] jail: consider PATH for argv in OCI container Signed-off-by: Daniel Golle --- jail/jail.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jail/jail.c b/jail/jail.c index aa9285c..5018fcc 100644 --- a/jail/jail.c +++ b/jail/jail.c @@ -714,7 +714,11 @@ static int exec_jail(void *pipes_ptr) exit(EXIT_FAILURE); INFO("exec-ing %s\n", *opts.jail_argv); - execve(*opts.jail_argv, opts.jail_argv, envp); + if (opts.envp) /* respect PATH if potentially set in ENV */ + execvpe(*opts.jail_argv, opts.jail_argv, envp); + else + execve(*opts.jail_argv, opts.jail_argv, envp); + /* we get there only if execve fails */ ERROR("failed to execve %s: %m\n", *opts.jail_argv); exit(EXIT_FAILURE); -- 2.30.2