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
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-16 04:10:14 +0400
committerJunio C Hamano <junkio@cox.net>2005-10-16 04:10:14 +0400
commit48bc2fb0cd9ca05005c2062c3493e62e13593f55 (patch)
tree2c0bccb31f8215ae4b49f3b667e300e824792e0e /receive-pack.c
parent652d5dc6c0aef842eafcd9d2f73a4836d20734e2 (diff)
Refuse to create funny refs in clone-pack, git-fetch and receive-pack.
Using git-check-ref-format, make sure we do not create refs with funny names when cloning from elsewhere (clone-pack), fast forwarding local heads (git-fetch), or somebody pushes into us (receive-pack). Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'receive-pack.c')
-rw-r--r--receive-pack.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/receive-pack.c b/receive-pack.c
index 06857eb77f..8f157bc3f0 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -95,6 +95,10 @@ static int update(const char *name,
char new_hex[60], *old_hex, *lock_name;
int newfd, namelen, written;
+ if (!strncmp(name, "refs/", 5) && check_ref_format(name + 5))
+ return error("refusing to create funny ref '%s' locally",
+ name);
+
namelen = strlen(name);
lock_name = xmalloc(namelen + 10);
memcpy(lock_name, name, namelen);