diff options
author | Junio C Hamano <junkio@cox.net> | 2005-10-13 18:57:39 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-10-15 11:23:39 -0700 |
commit | d8a1deecc6ef37728b951eaba051deb7e0a38af8 (patch) | |
tree | 46880218861d52fb0c30d520030a70cd32bca163 /receive-pack.c | |
parent | 03feddd6e8e779086ac2d131ded325f8e5601653 (diff) | |
download | git-d8a1deecc6ef37728b951eaba051deb7e0a38af8.tar.gz |
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.c | 4 |
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); |