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>
Jacob Keller committed
Feb 29, 2016 at 14:58 UTC
7dad2633348423191844eef49022a9013242d6ef
1 file changed
+3
-3
builtin/submodule--helper.c
+3
-3
@@ -186,15 +186,15 @@ static int module_clone(int argc, const char **argv, const char *prefix)
186
187
const char *const git_submodule_helper_usage[] = {
188
N_("git submodule--helper clone [--prefix=<path>] [--quiet] "
189
- "[--reference <repository>] [--name <name>] [--url <url>]"
190
- "[--depth <depth>] [--path <path>]"),
189
+ "[--reference <repository>] [--name <name>] [--depth <depth>] "
190
+ "--url <url> --path <path>"),
191
NULL
192
};
193
194
argc = parse_options(argc, argv, prefix, module_clone_options,
195
git_submodule_helper_usage, 0);
196
197
- if (argc)
197
+ if (argc || !url || !path)
198
usage_with_options(git_submodule_helper_usage,
199
module_clone_options);
200