From 5ce58ff0eb94c3b1adbc1787fed65dbd6e25f32a Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Mon, 29 Feb 2016 14:58:33 -0800 Subject: [PATCH] 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 Reviewed-by: Stefan Beller Signed-off-by: Junio C Hamano Signed-off-by: Johannes Schindelin --- builtin/submodule--helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index f7a37b9c67..f2b571565d 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -180,8 +180,8 @@ 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=] [--quiet] " - "[--reference ] [--name ] [--url ]" - "[--depth ] [--path ]"), + "[--reference ] [--name ] [--depth ] " + "--url --path "), NULL }; @@ -191,7 +191,7 @@ static int module_clone(int argc, const char **argv, const char *prefix) if (!path || !*path) die(_("submodule--helper: unspecified or empty --path")); - if (argc) + if (argc || !url) usage_with_options(git_submodule_helper_usage, module_clone_options);