summaryrefslogtreecommitdiff
path: root/receive-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-14 01:57:39 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-10-15 18:23:39 (GMT)
commitd8a1deecc6ef37728b951eaba051deb7e0a38af8 (patch)
tree46880218861d52fb0c30d520030a70cd32bca163 /receive-pack.c
parent03feddd6e8e779086ac2d131ded325f8e5601653 (diff)
downloadgit-d8a1deecc6ef37728b951eaba051deb7e0a38af8.zip
git-d8a1deecc6ef37728b951eaba051deb7e0a38af8.tar.gz
git-d8a1deecc6ef37728b951eaba051deb7e0a38af8.tar.bz2
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 06857eb..8f157bc 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);