summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2016-02-29 14:58:33 -0800
committerJunio C Hamano <gitster@pobox.com>2016-03-01 12:24:10 -0800
commit7dad2633348423191844eef49022a9013242d6ef (patch)
tree3f0b443b9729808dd295a6b5c0c3b55c17e3230c
parent717416ca87edcd3889e40d8191fd4b6721e8a02e (diff)
downloadgit-7dad2633348423191844eef49022a9013242d6ef.tar.gz
submodule: fix segmentation fault in submodule--helper clone
The git submodule--helper clone command will fail with a segmentation fault when given a null url or null path variable. Since these are required for proper functioning of the submodule--helper clone subcommand, add checks to prevent running and fail gracefully when missing. Update the usage string to reflect the requirement that the --url and --path "options" are required. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/submodule--helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 3c4d3ff7f4..35ae85a7e1 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -186,15 +186,15 @@ static int module_clone(int argc, const char **argv, const char *prefix)
const char *const git_submodule_helper_usage[] = {
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
- "[--reference <repository>] [--name <name>] [--url <url>]"
- "[--depth <depth>] [--path <path>]"),
+ "[--reference <repository>] [--name <name>] [--depth <depth>] "
+ "--url <url> --path <path>"),
NULL
};
argc = parse_options(argc, argv, prefix, module_clone_options,
git_submodule_helper_usage, 0);
- if (argc)
+ if (argc || !url || !path)
usage_with_options(git_submodule_helper_usage,
module_clone_options);