Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/fsck.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-09-24 11:37:17 +0300
committerJunio C Hamano <gitster@pobox.com>2018-09-27 21:41:26 +0300
commita124133e1e6ab5c7a9fef6d0e6bcb084e3455b46 (patch)
treeb2feaba2c06781e934d4888f89a1dbe632a49777 /fsck.c
parente43aab778c72250e11eb00e31dc6be90072a1637 (diff)
fsck: detect submodule urls starting with dash
Urls with leading dashes can cause mischief on older versions of Git. We should detect them so that they can be rejected by receive.fsckObjects, preventing modern versions of git from being a vector by which attacks can spread. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fsck.c')
-rw-r--r--fsck.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fsck.c b/fsck.c
index 9339f31513..c472856527 100644
--- a/fsck.c
+++ b/fsck.c
@@ -64,6 +64,7 @@ static struct oidset gitmodules_done = OIDSET_INIT;
FUNC(GITMODULES_PARSE, ERROR) \
FUNC(GITMODULES_NAME, ERROR) \
FUNC(GITMODULES_SYMLINK, ERROR) \
+ FUNC(GITMODULES_URL, ERROR) \
/* warnings */ \
FUNC(BAD_FILEMODE, WARN) \
FUNC(EMPTY_NAME, WARN) \
@@ -945,6 +946,12 @@ static int fsck_gitmodules_fn(const char *var, const char *value, void *vdata)
FSCK_MSG_GITMODULES_NAME,
"disallowed submodule name: %s",
name);
+ if (!strcmp(key, "url") && value &&
+ looks_like_command_line_option(value))
+ data->ret |= report(data->options, data->obj,
+ FSCK_MSG_GITMODULES_URL,
+ "disallowed submodule url: %s",
+ value);
free(name);
return 0;