Don't support --args inside an --args file
This would let you create a recursive operation filling up the stack and causing a crash. Closes: #47 Approved by: cgwalters
This commit is contained in:

committed by
Colin Walters (automation)

parent
055f58c245
commit
90c20f2c8e
10
bubblewrap.c
10
bubblewrap.c
@@ -799,7 +799,8 @@ int opt_seccomp_fd = -1;
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
parse_args (int *argcp,
|
parse_args (int *argcp,
|
||||||
char ***argvp)
|
char ***argvp,
|
||||||
|
bool in_file)
|
||||||
{
|
{
|
||||||
SetupOp *op;
|
SetupOp *op;
|
||||||
int argc = *argcp;
|
int argc = *argcp;
|
||||||
@@ -828,6 +829,9 @@ parse_args (int *argcp,
|
|||||||
int data_argc;
|
int data_argc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (in_file)
|
||||||
|
die ("--args not supported in arguments file");
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
die ("--args takes an argument");
|
die ("--args takes an argument");
|
||||||
|
|
||||||
@@ -866,7 +870,7 @@ parse_args (int *argcp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
data_argv_copy = data_argv; /* Don't change data_argv, we need to free it */
|
data_argv_copy = data_argv; /* Don't change data_argv, we need to free it */
|
||||||
parse_args (&data_argc, &data_argv_copy);
|
parse_args (&data_argc, &data_argv_copy, TRUE);
|
||||||
|
|
||||||
argv += 1;
|
argv += 1;
|
||||||
argc -= 1;
|
argc -= 1;
|
||||||
@@ -1200,7 +1204,7 @@ main (int argc,
|
|||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
|
|
||||||
parse_args (&argc, &argv);
|
parse_args (&argc, &argv, FALSE);
|
||||||
|
|
||||||
/* We have to do this if we weren't installed setuid, so let's just DWIM */
|
/* We have to do this if we weren't installed setuid, so let's just DWIM */
|
||||||
if (!is_privileged)
|
if (!is_privileged)
|
||||||
|
Reference in New Issue
Block a user