diff options
Diffstat (limited to 'builtin/clone.c')
-rw-r--r-- | builtin/clone.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index 97de324e54..1f6338a223 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -255,6 +255,15 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare) } /* + * It should not be possible to overflow `ptrdiff_t` by passing in an + * insanely long URL, but GCC does not know that and will complain + * without this check. + */ + if (end - start < 0) + die(_("No directory name could be guessed.\n" + "Please specify a directory on the command line")); + + /* * Strip trailing port number if we've got only a * hostname (that is, there is no dir separator but a * colon). This check is required such that we do not |