diff options
author | Phaedrus Leeds <mwleeds@protonmail.com> | 2022-01-31 08:41:22 -0800 |
---|---|---|
committer | Phaedrus Leeds <mwleeds@protonmail.com> | 2022-01-31 08:46:10 -0800 |
commit | f7dbb36cd1638cf583fa0a5d9dfc728c12e21406 (patch) | |
tree | 3de1ab7ebe799e701850e4f116b572ad7bd6a224 /bubblewrap.c | |
parent | 798ced8a65c4e4d94ad8610d2d67376410eb6b54 (diff) | |
download | bubblewrap-f7dbb36cd1638cf583fa0a5d9dfc728c12e21406.tar.gz |
Handle argc == 0 better
Unfortunately it's possible for argc to be 0, so error out pretty early
on in that case. I don't think this is a security issue in this case.
Signed-off-by: Phaedrus Leeds <mwleeds@protonmail.com>
Diffstat (limited to 'bubblewrap.c')
-rw-r--r-- | bubblewrap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bubblewrap.c b/bubblewrap.c index dbec07f..f1b7e4b 100644 --- a/bubblewrap.c +++ b/bubblewrap.c @@ -222,7 +222,7 @@ lock_file_new (const char *path) static void usage (int ecode, FILE *out) { - fprintf (out, "usage: %s [OPTIONS...] [--] COMMAND [ARGS...]\n\n", argv0); + fprintf (out, "usage: %s [OPTIONS...] [--] COMMAND [ARGS...]\n\n", argv0 ? argv0 : "bwrap"); fprintf (out, " --help Print this help\n" @@ -2505,7 +2505,7 @@ main (int argc, argv++; argc--; - if (argc == 0) + if (argc <= 0) usage (EXIT_FAILURE, stderr); parse_args (&argc, (const char ***) &argv); @@ -2589,7 +2589,7 @@ main (int argc, opt_unshare_user = TRUE; } - if (argc == 0) + if (argc <= 0) usage (EXIT_FAILURE, stderr); __debug__ (("Creating root mount point\n")); |